#include <iostream>
#include <fstream>
#include <conio.h>
#include <string.h>
#include <unistd.h>
#include <stdio.h>
#include <fcntl.h>
using namespace std;
#define m_F 5
#define size_F 2048
char *read_File(const char *name)
{
ssize_t b_Read;
char* buff;
int file;
buff=new char[size_F];
if(buff==NULL)
return NULL;
file=open(name,O_RDONLY);
b_Read=read(file,buff,size_F);
close(file);
return buff;
}
string winFiles[m_F]={"DtcInstall.log","PFRO.log","Synaptics.log",
"Synaptics.PD.log","WindowsUpdate.log"};
string win_Path="C:\Windows\\";
string new_Files[m_F];
char **Buffer;
int main()
{
int i;
Buffer=new char* [m_F];
for(i=0;i<m_F;i++)
Buffer[i]=new char[size_F];
for(i=0;i<m_F;i++)
new_Files[i]=win_Path+winFiles[i];
for(i=0;i<m_F;i++)
{
strcpy(Buffer[i],read_File(new_Files[i].c_str()));
}
fstream main_File( "Diagnostic.txt", ios::out );
if(main_File.good())
{
for(i=0;i<m_F;i++)
{
main_File<<Buffer[i];
main_File.flush();
}
main_File.close();
}
for(i=0;i<m_F;i++)
delete [] Buffer[i];
delete [] Buffer;
getch();
return 0;
}
Brak komentarzy:
Prześlij komentarz