Re: Problem with binary files

new topic     » goto parent     » topic index » view thread      » older message » newer message

>     f = open("zz", "w")
should be
>     f = open("zz", "wb")
because of DOS's file text mode.

IMHO, Microsoft is far too anti-POSIX. Why?

jbrown

On Sun, Apr 29, 2001 at 12:43:32AM -0300, rforno at tutopia.com wrote:
> 
> 
> I am working in a program that generates MIDI files. After getting strange
> results, I traced the problem to the puts() command. It keeps generating #0D
> characters before each #0A. The program was run under DOS under Windows 98.
> The reduced test program is very simple:
> procedure test()
>     integer f
>     sequence s
>     f = open("zz", "w")
>     s = {}
>     for i = 0 to 2 do
>          for j = 0 to 255 do
>              s &= j
>          end for
>     end for
>     puts(f, s)
>     close(f)
> end procedure
> test()
> I am attaching the output of this program.
> Does anybody know how to get rid of the extraneous #0D characters?
> 
> 
> 
> 

-- 
Linux User:190064
Linux Machine:84163
http://jbrown105.1avenue.com

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu