1. "r"/"rb" & "w"/"wb" differences
before I ask my questions, assume the file
"THISFILE.DAT" contains the following:
ONE:EINS
TWO:ZWEI
THREE:DREI
FOUR:VIER
FIVE:FUENF
If I open it with the following line:
hdl = open("thisfile.dat","r")
how is it different that doing this?:
hdl = open("thisfile.dat","rb")
When I've read data from files, I've gotten the same
data from "r" as I have from "rb." What is the
difference between an opening mode and its binary
counterpart?
Thanks for the clarification,
Mike Hurley
=====
It compiled. The first screen came up. Ship it.
--Bill Gates
__________________________________________________
Do You Yahoo!?
Send instant messages & get email alerts with Yahoo! Messenger.
http://im.yahoo.com/
2. Re: "r"/"rb" & "w"/"wb" differences
when in binary mode, reading doesn't stop at EOF and entire CRLF pairs are
read and written. that's the difference
- Matt
3. Re: "r"/"rb" & "w"/"wb" differences
On Wed, 23 Aug 2000, Darth Maul, aka Matt wrote:
> when in binary mode, reading doesn't stop at EOF and entire CRLF pairs are
> read and written. that's the difference
>
> - Matt
if you are talking linux, then there is only an LF.
windoze = CRLF
linux = LF
does Eu know the difference Rob?
--
cense
a member of the
ak-software development team
http://ak-software.virtualave.net/
contract work for
Web Velocity IT inc.
http://www.webvelocity.ca/
4. Re: "r"/"rb" & "w"/"wb" differences
cense writes:
> if you are talking linux, then there is only an LF.
> windoze = CRLF
> linux = LF
> does Eu know the difference Rob?
In Linux there is no "text" mode for file I/O, there is only
what DOS calls "binary" mode. Linux Euphoria programs
can open files with "r" or "rb", it makes no difference.
Same thing for "w" vs "wb" etc.
Lines of text normally end with \n on Linux.
In DOS they normally end with \r\n, but in "text" mode
the \r is removed by the operating system
on input, and restored on output. There is no point
to this hocus pocus. It's just a fact of life
on DOS (or Windows). It doesn't usually cause a portability
problem for Euphoria programs, since you typically see just a \n
at the end of each line on either system.
Regards,
Rob Craig
Rapid Deployment Software
http://www.RapidEuphoria.com
5. Re: "r"/"rb" & "w"/"wb" differences
On Wed, 23 Aug 2000, Robert Craig wrote:
> cense writes:
> > if you are talking linux, then there is only an LF.
> > windoze = CRLF
> > linux = LF
> > does Eu know the difference Rob?
>
> In Linux there is no "text" mode for file I/O, there is only
> what DOS calls "binary" mode. Linux Euphoria programs
> can open files with "r" or "rb", it makes no difference.
> Same thing for "w" vs "wb" etc.
> Lines of text normally end with \n on Linux.
> In DOS they normally end with \r\n, but in "text" mode
> the \r is removed by the operating system
> on input, and restored on output. There is no point
> to this hocus pocus. It's just a fact of life
> on DOS (or Windows). It doesn't usually cause a portability
> problem for Euphoria programs, since you typically see just a \n
> at the end of each line on either system.
>
> Regards,
> Rob Craig
> Rapid Deployment Software
> http://www.RapidEuphoria.com
good answer rob!
--
cense
a member of the
ak-software development team
http://ak-software.virtualave.net/
contract work for
Web Velocity IT inc.
http://www.webvelocity.ca/