Sign in to follow this  

windows reporting wrong file size?

Recommended Posts

firstly, i open a file using std::ostream at the beggning, seek to the end, get the position and save this position. Now i write some data to the end of the file. later on, i read on the contents of the file using read(buffer, origonal_file_size) as to get the contents of the file before i appended any data, i then write this back out the the file. Now i get all the old file plus i get some crap left from what i appended? im guessing it has to do with windows using \r\n for new lines? what can i do besides having to manually read through the file line by line (text file btw). the same code works perfectly on linux

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this