Im able to copy the entire content of say file A to file B but the last line of file B end with several unwanted tttttt. I suspected the number of "t" is related to the number of line if read and written. Any advise will be greatly appreciated.
file A
[TEX]sdakodjskfjsdkfjasook
sample1. : 0987654321
ofjsdfjasfjsdkf
dflsdj
sample1. :[/TEX]
file B
[TEX]sdakodjskfjsdkfjasook
sample1. : 0987654321
ofjsdfjasfjsdkf
dflsdj
sample1. :ÍÍÍÍÍÍÍ[/TEX]
My code;
char * fbuffer;
long fsize;
ifstream cpy ("sample.txt");
ofstream target (finaldir.c_str());
cpy.seekg(0,ifstream::end);
fsize=cpy.tellg();
cpy.seekg(0);
fbuffer = new char [fsize];
cpy.read (fbuffer,fsize);
target.write (fbuffer,fsize);
delete[] fbuffer;
target.close();