From mboxrd@z Thu Jan 1 00:00:00 1970 From: Earnie Boyd To: Peter Ring Cc: cygwin users Subject: RE: LF vs. CR/LF (WAS: Problems with libtiff!) Date: Mon, 21 Jun 1999 09:17:00 -0000 Message-id: <19990621162042.3520.rocketmail@send205.yahoomail.com> X-SW-Source: 1999-06/msg00473.html --- Peter Ring wrote: > What is the correct way to open, read, and write a 'text' file on a > filesystem shared between a number of different operating systems? > (please note that this is in effect what cygwin amounts to). > > The scenario could be a 'text' file shared between MacOS, WinNT, and > some UNIX-like OS. The file might be shared in several ways, some of > which would make it impractical (if not outright nonsense) to talk about > one specific OS 'hosting' the file. > A good question to ask when wanting to create a multi-platform program that writes to multi-platform disks. Frankly, in this situation I would open the file in binary mode, and handle the line formatting characters within the module. If I were writing a text file from the program I would ensure that the last character of the line were a null so that the line formatting characters would be eliminated by default when read. > Some applications, e.g. emacs, try to guess from the file's content what > to do. Obviously, this works only for interactive applications. > > I won't argue with the benefits of explicitly opening files 'rb'. I just > wonder why anyone would ever want to do anytning else? > To deal with the native tools that exist. E.G.: Notepad (I know, a bad example, but it's a good bad example) which opens the file in binary mode and expects to find the \r\n to know when to display on the next line. === Earnie Boyd < mailto:earnie_boyd@yahoo.com > Newbies, please visit < http://www.freeyellow.com/members5/gw32/index.html > (If you respond to the list, then please don't include me) _________________________________________________________ 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@sourceware.cygnus.com From mboxrd@z Thu Jan 1 00:00:00 1970 From: Earnie Boyd To: Peter Ring Cc: cygwin users Subject: RE: LF vs. CR/LF (WAS: Problems with libtiff!) Date: Wed, 30 Jun 1999 22:10:00 -0000 Message-ID: <19990621162042.3520.rocketmail@send205.yahoomail.com> X-SW-Source: 1999-06n/msg00473.html Message-ID: <19990630221000.8gQ_mpHXEeF2hazWeL694SYxYSQES666TEzXaLKL9V0@z> --- Peter Ring wrote: > What is the correct way to open, read, and write a 'text' file on a > filesystem shared between a number of different operating systems? > (please note that this is in effect what cygwin amounts to). > > The scenario could be a 'text' file shared between MacOS, WinNT, and > some UNIX-like OS. The file might be shared in several ways, some of > which would make it impractical (if not outright nonsense) to talk about > one specific OS 'hosting' the file. > A good question to ask when wanting to create a multi-platform program that writes to multi-platform disks. Frankly, in this situation I would open the file in binary mode, and handle the line formatting characters within the module. If I were writing a text file from the program I would ensure that the last character of the line were a null so that the line formatting characters would be eliminated by default when read. > Some applications, e.g. emacs, try to guess from the file's content what > to do. Obviously, this works only for interactive applications. > > I won't argue with the benefits of explicitly opening files 'rb'. I just > wonder why anyone would ever want to do anytning else? > To deal with the native tools that exist. E.G.: Notepad (I know, a bad example, but it's a good bad example) which opens the file in binary mode and expects to find the \r\n to know when to display on the next line. === Earnie Boyd < mailto:earnie_boyd@yahoo.com > Newbies, please visit < http://www.freeyellow.com/members5/gw32/index.html > (If you respond to the list, then please don't include me) _________________________________________________________ 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@sourceware.cygnus.com