I am writing string like this,
in both linux and windows, the returned offset is 9. In linux number of actual written bytes is 9, but in windows it is 10.
Code: Select all
std::string header; header = "%PDF-1.4\n"; int offset = header.size(); std::ofstream stream; stream.open(filename); stream << header; stream.close();
This may be due to the different line ending types. linux uses LF and windows uses CRLF (\r\n).
How can I get the actual size of the string that is written?
Or how can I use only LF newline even in windows platform?