Below is my code. My problem is, my destination file always has a lot more strings than the originating file. Then, inside the for loop, instead of using i < sizeof more
, I realized that I should use i < sizeof file2
. Now my problem is, how to get the size of file2?
int i = 0;
FILE *file2 = fopen(LOG_FILE_NAME,"r");
wfstream file3 (myfile, ios_base::out);
// char more[1024];
char more[SIZE-OF-file2];
for(i = 0; i < SIZE-OF-file2 ; i++)
{
fgets(more, SIZE-OF-file2, file2);
file3 << more;
}
fclose(file2);
file3.close();