Francis Harvey wrote:

> Thanks.  I have now replaced \n with \r\n every place I used \n in a
> character string.  I have made sure not to switch the single character
> when used separately from a string.  Everything appears to work fine
> now.

But that completely misses the point of "text" mode.  You should always
use just "\n" in your strings in the source code, and open any files
containing text in "text" mode i.e. fopen("foo", "rt").  That way, when
you read and write to the file "\n" will be converted to "\r\n" by the
io library, but your code will be portable to any other posix system.

If you explicitly use "\r\n" in your program then you have to make sure
the file is always opened in binary mode otherwise you'll could get
"\r\r\n" as your line delimiter.

Brian

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

Reply via email to