Skip to main content
gamedev.net
🔒 Locked

File writing

Started by tobiasrox 0 replies 450+ views
Original Post
tobiasrox
tobiasrox
Hello everybody.

I was trying to do a simple file transfer server/client but i got stuck into a damn problem. I send the buffers and everything is fine until i try to put them into a file. Don't know why but instead of writing "\r\n" fwrite is writing "\r\r\n".

I've search about this and found something about at microsoft's website( http://msdn.microsoft.com/en-us/library/h9t88zwz.aspx). It says:
Quote:
The fwrite function writes up to count items, of size length each, from buffer to the output stream. The file pointer associated with stream (if there is one) is incremented by the number of bytes actually written. If stream is opened in text mode, each carriage return is replaced with a carriage-return – linefeed pair. The replacement has no effect on the return value.

This function locks the calling thread and is therefore thread-safe. For a non-locking version, see _fwrite_nolock.


Nevermind :D! I didn't know that w+ would open a file in text mode!

Thanks in advance. :)

[Edited by - fusionn32 on June 29, 2010 10:06:02 PM]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.