Re: Mac text files and gets()
- Posted by Robert Craig <rds at ?apidEuphoria.com> Sep 16, 2007
- 500 views
CChris wrote: > This also answers to Rob. "r" and "rb" are different strungs, so you may > expect > a slightly different result from them, even under Linux. Or are you saying > that > people use "r" indiscriminately when using a Unix-like filesystem? If so, and > if the practice is condoned, then the mod would have to be restricted to > Windows, > or not be there at all - there have been requests for a Windows-specific Eu > anyway in the past. In Euphoria, "r" and "rb" are equivalent on Linux/FreeBSD, so I usually just code "r", knowing I'm going to input the exact bytes in the file, with no alteration. Only DOS/Windows has the silly concept of opening a file in "text" mode ("r"), with \r\n on input automatically replaced by the operating system with "\n". On output, a file opened as "w" on DOS/Windows will have "\n" replaced by "\r\n". Other languages, such as C also let you open a file on DOS/Windows as either "r" or "rb", "w" or "wb", but keep in mind it's the operating system that does the fiddling around, not the language. In DOS/Windows, although I think it's a bad idea, you could argue that "r" mode (but certainly not "rb" mode) gives you license to alter the input and detect many different characters or combinations of characters as line terminators, but on Linux/FreeBSD this would not make sense to programmers on that system, and not to Euphoria programmers who have already coded "r", knowing that it's the same as "rb". You really can't mess around with "r" mode on Linux/FreeBSD. You *will* break code. As for DOS/Windows, if you are still determined to add this, we can eventually have a vote on it. My vote would be NO. Regards, Rob Craig Rapid Deployment Software http://www.RapidEuphoria.com