I have a file I'm writing to and then changing the size of it to the size of text written to it something like:
FILE * file...
I get all the data from the file and change the file's size to the data's size but it differs. The string's size is smaller then the filelength and it cuts it and loses data. What might be the problem?
while(fgets(cLine, sizeof(cLine), file) )
str.append((string)cLine);
fputs(str.c_str(),file);
_chsize( fileno(file), (int)str.size() );
When I checked it always fileLength(fileno(file))
is larger than str.size()
!