Mail Archives: cygwin/1999/06/15/09:26:06
--- Aldo Mazzilli <aldo DOT mazzilli AT inria DOT fr> wrote:
> Hello there,
>
> can someone tell me how CYGWIN32 handles text and binary files ??
>
> Especially with :
>
> - open() call
> - pipes and sockets
> - tty's and ptys
> - cat() command
>
> What is the best way to control the case where \r characters are
> inserted in front of each \n.
>
> The problem is because I have a program which counts the bytes of a
> file, and I have to modifiy it in order to :
> - count 1 byte at each newline under Unix
> - count 2 bytes at each newline under Win32
>
> What is the best way to do that ??
First let me say read the documentation and search the archives. There exists
lots of information on this subject.
Now, to answer the counting problem. Open the files in O_BINARY or "rb" mode.
The \r will then be returned as data and the number of characters returned by
the read will be correct.
===
YAWIA,
Earnie Boyd <mailto:earnie_boyd AT yahoo DOT com>
Newbies, please visit
<http://www.freeyellow.com/members5/gw32/index.html>
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com
- Raw text -