Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm Sender: cygwin-owner AT sourceware DOT cygnus DOT com Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com Message-ID: <19990621162042.3520.rocketmail@send205.yahoomail.com> Date: Mon, 21 Jun 1999 09:20:42 -0700 (PDT) From: Earnie Boyd Reply-To: earnie_boyd AT yahoo DOT com Subject: RE: LF vs. CR/LF (WAS: Problems with libtiff!) To: Peter Ring Cc: cygwin users MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii --- 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 Newbies, please visit (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 AT sourceware DOT cygnus DOT com