[#3986] Re: Principle of least effort -- another Ruby virtue. — Andrew Hunt <andy@...>

> Principle of Least Effort.

14 messages 2000/07/14

[#4043] What are you using Ruby for? — Dave Thomas <Dave@...>

16 messages 2000/07/16

[#4139] Facilitating Ruby self-propagation with the rig-it autopolymorph application. — Conrad Schneiker <schneik@...>

Hi,

11 messages 2000/07/20

[ruby-talk:04157] RE: Inconsistent file access on Windows ports

From: Aleksi Niemel<aleksi.niemela@...>
Date: 2000-07-21 09:14:21 UTC
List: ruby-talk #4157
> My Wintoys seems to behave differently with two distributions 
> and each time not in a way I'm expecting:

Let me add that during the night I vaguely remembered some kind of different
binary filehandling on DOS (if I recall correctly you could specify /b or /a
for some utilities to access the file in binary or ascii mode).

Thus

>   str = 10.chr+13.chr+10.chr+13.chr+"foo"
>   outf = File.new("foo", "w")
>   outf.write(str)

works marvellously if opening is changed to

    outf = File.new("foo", "w").binmode

The file size will be 7 and there's no extra characters.

Even so I think the question is appropriate, why two ports work differently
when writing binary data to an ascii stream? 

And of course, what's considered to be binary data? Is it /[^\w\d]/? Maybe
punctuation won't be either. And it seemed that "\n" works well too. 

	- Aleksi

In This Thread

Prev Next