Re: fwrite, fgets binary file readback problem
Richard Tobin wrote:
.... snip quotation without attribution ...
If the raw file contains a cr lf sequence reading that file as text
under Windoze will return \n. Under Unix it will return \r\n. If
the file is opened as a binary file, Unix is unchanged, but Windoze
will return \r\n.
--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home .att.net>
Try the download section.
** Posted from http://www.teranews.com **
Richard Tobin wrote:
CBFalconer <cbfalconer@mai neline.netwrote :
>
>
>
>
I don't see the relevance of your comment. On both Unix and
Windows, there is no difference between getc(), fgets(), and
fread() in respect of how they handle line ends. They all
convert them in text mode (and the conversion is a no-op in Unix),
and none of them convert them in binary mode.
>On *ix, but not doze. Under *ix the files are identical, under
>doze there are \r in the char sequence for text files, which will
>be absorbed if followed by a \n. This doesn't happen for a binary
>file. And there are many other file systems.
>doze there are \r in the char sequence for text files, which will
>be absorbed if followed by a \n. This doesn't happen for a binary
>file. And there are many other file systems.
I don't see the relevance of your comment. On both Unix and
Windows, there is no difference between getc(), fgets(), and
fread() in respect of how they handle line ends. They all
convert them in text mode (and the conversion is a no-op in Unix),
and none of them convert them in binary mode.
under Windoze will return \n. Under Unix it will return \r\n. If
the file is opened as a binary file, Unix is unchanged, but Windoze
will return \r\n.
--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home .att.net>
Try the download section.
** Posted from http://www.teranews.com **
Comment