This is the mail archive of the mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

B19: How to read dos (crlf) text files?

I'm running cygwin32 B19.1 under win95a.
I take part in developing the latex2rtf converter package
(previously under the BSD license, now under the GNU license)
which is being developed under Linux 
and also compiles and runs ok on a DEC Alpha under DEC OSF/1.
I now want to get a win32 port of it. 
It successfully compiles with cygwin32, but if I feed it with
a dos/win-formatted file (end-of-line = crlf) 
I get a "read error in line 2".
If I save the input file in Unix mode (end-of-line = lf),
it is successfully read.
Input is via stdin, call is "latex2rtf <infile >outfile"

YES, I have read the mailing list archive AND also the FAQ.

NO, I don't want to renew the discussion whether 
it makes sense to distinguish between text mode and binary.

I JUST want to get it working.

The FAQ sais as follows:
>How is the DOS/Unix CR/LF thing handled?
>By default, tools that deal with binaries (e.g. objdump) 
>operate in unix binary mode and tools that
>deal with text files (e.g. bash) operate in text mode. 
>You can enable the DOS CR/LF end of line in a text file mode 
>by setting fmode_binary setting in the registry to 0. 

I did not find this key. I instead found (among others):
[HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\

Now IS this the required key (obviously it IS set to 0) or not?

>I've tried to keep the file types 'natural'. 
>By default a file is opened in text mode.
>This can be changed by adding O_BINARY 
>to the second argument of an open call, 
>or "b" to second argument of an fopen call. 
>You can also call setmode (fd, O_BINARY). 

The fopens ARE without the "b" switch.

What is wrong?

Thanks for any help,

Dipl.-Ing. Wilfried Hennings c./o. 
Forschungszentrum (Research Center) Juelich GmbH, ISR 
D-52425 Juelich, Germany 
Tel. (+49) 2461 61 5570 ; Fax (G3+G4) (+49) 2461 61 8254
email: <>
my pgp (2.6.3i) public key: <>
ISR homepage: <>
Join the fight against spam!  details at <>
All opinions mentioned are strictly my own, not my employer's

For help on using this list (especially unsubscribing), send a message to
"" with one line of text: "help".

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]