[GRASS5] Libgrass_gis on Mingw - open.c patch

Glynn Clements glynn at gclements.plus.com
Fri May 13 04:37:28 EDT 2005


Radim Blazek wrote:

> > This patch solves the problem of binary files read/write under win32.
> > Practically forces the c runtime to binary-mode file translation as 
> > default.
> > It is not the cleanest way but it is simple.
> > More info at: http://www.mingw.org/MinGWiki/index.php/binary
> 
> Isn't it better to use 'b' as mode for fdopen?

By default MinGW will perform EOL translation for files which are
accessed via the POSIX compatibility functions (open, read, write),
not just for the ANSI stdio functions.

> Do I understand it correctly that text files on windows will be also 
> written with LF only so that a mapset can be accessed from UNIX without 
> problems?
> 
> Could it happen that also files which should be opened as text will be 
> opened as binary? For example text input for modules.

All files should be opened as binary on all platforms. GRASS should do
its own EOL translation where necessary, so that files created on
Windows will work on Unix.

-- 
Glynn Clements <glynn at gclements.plus.com>




More information about the grass-dev mailing list