TEXT mode, BINARY mode default file opening

Gerrit P. Haase gerrit@familiehaase.de
Mon Jan 24 12:24:00 GMT 2005

Pete James wrote:

> Hello,
> I am new to the list a have only been using CYGWIN for a few months.
> I would like to use the GNU compiler as a cross compiler for a Windoze
> machine and I am having problems with the files being opened in BINARY
> mode, I think.
> I have the whole system running on Windoze 2000 using an old version of
> CYGWIN circa version 1.5.5, it all works perfectly but when I try and
> install it on a Windoze XP machine it CYGWIN falls over with a heap
> allocation error. So, looking at the FAQ etc I learn that I need the new
> version of CYGWIN.
> I install the latest version of CYGWIN on my Windoze XP machine and I
> have no heap problems but what I get now is 'Invalid token in
> expression' errors from the compiler on lines of code that wrap past the
> carriage return. I understand that this is due to the way in which MSDOS
> and UNIX text files are stored. Anyway looking at the FAQ etc, I find
> that there is an environmental variable CYGWIN which if I make
> =nobinmode it will not open the files in BINARY. Well sure enough if I
> run CYGWIN and type mount all my mounts are in TEXT mode. But the
> compiler still doesn't work. Looking deeper, I find that the latest
> versions of CYGWIN default to BINARY and older ones TEXT mode. This I
> think explains it. But how do I get the compiler to open the files in
> TEXT mode.
> This is what I think is happening. The compiler is being activated from
> JAVA application which is creating an MSDOS shell. When the compiler is
> called, the CYGWIN DLL loads, when this happens will the CYGWIN
> environment variable be used? I also have found information that says is
> the path called is explicit with a drive letter for example, then the
> opening mode will be BINARY. Can this be changed to TEXT?
> Unfortunately I can't change all the files to remove the extra carriage
> returns or line feeds as the files are used by other programs. So I
> think my options are:
> 1. Try and find a way of CYGWIN to open the files correctly (if indeed
> it is caused by CYGWIN, note I don't say problem with CYGWIN)
> 2. Try and find an intermediate version of CYGWIN, I think 1.5.9 has the
> XP heap fixed but not the default mount mode changed.
> 3. Recompile the compiler with --no-cygwin, will this allow it to work
> in Windozes without CYGWIN?
> 4. Recompile the compiler with a windows compiler so as to make it a
> native windoze application.
> Well, thanks for reading all that, I hope some of you out there have
> some good thoughts, and ideas for me to try.

I never have any problems with any files, regardless which mode these
files are.  GCC doesn't care if you use \r\n or \n as line ending.

What are extra carriage returns?  You have \r\n or you have \n, what
else could be there?

Your options:
1. Binary mode opens a file as is and if that doesn't work your files
are broken?
2. No older version of Cygwin is supported.
3. MinGW GCC is what you'e looking for.
4. MinGW GCC is what you'e looking for.


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/

More information about the Cygwin mailing list