Re: Problem with binary files

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

Howdy!

Part of your program may be that you are not opening the file as a binary file. 
The combination
#0A#0D is "\r\n."  Instead of 

 f = open("zz", "w")

try

 f = open("zz", "wb")

and see if that gets its act straight.

-- Travis --


4/28/2001 10:43:32 PM, 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?

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

Search



Quick Links

User menu

Not signed in.

Misc Menu