1. Problem with binary files

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     » topic index » view message » categorize

2. Re: Problem with binary files

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 message » categorize

3. Re: Problem with binary files

>     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 message » categorize

4. Re: Problem with binary files

----- Original Message ----- 
From: <jbrown105 at HotPOP.com>
> 
> IMHO, Microsoft is far too anti-POSIX. Why?
> 

Isn't POSIX some kind of a standard? 
Doesn't that explain the M$ attitude?

Regards,
Irv

new topic     » goto parent     » topic index » view message » categorize

5. Re: Problem with binary files

On Sun, Apr 29, 2001 at 05:01:57PM -0400, Irv Mullins wrote:
>=20
> Typically in 7 days. AND give customers 60 days to pay.
> Click here and learn about Inzap=12s Invoice Payment Service.
> Click here and learn about Inzap=12s Invoice Payment Service.
>=20
>=20
> ----- Original Message -----=20
> From: <jbrown105 at HotPOP.com>
> >=20
> > IMHO, Microsoft is far too anti-POSIX. Why?
> >=20
>=20
> Isn't POSIX some kind of a standard?=20
> Doesn't that explain the M$ attitude?
>=20
> Regards,
> Irv

Why?

>=20
> online... at Zappos.com. Hard-to-find sizes in brands like
> Bass, Dexter, Hush Puppies, Skechers, and Steve Madden:
>=20
>=20
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>=20
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>=20
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>=20
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

jbrown

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

new topic     » goto parent     » topic index » view message » categorize

6. Re: Problem with binary files

On Sun, 29 Apr 2001, jbrown105 at HotPOP.com wrote:

> > > IMHO, Microsoft is far too anti-POSIX. Why?
> > > 
> > Isn't POSIX some kind of a standard? 
> > Doesn't that explain the M$ attitude?
> > 
> > Regards,
> > Irv
> 
> Why?

It's very simple, really. They (M$) will never support a standard that 
they don't control.  Controlling the standard means they can change 
it whenever they wish. Why would they want to do that? Let's just 
suppose, for example, that jbrown software comes out with a new 
program that everybody thinks is wonderful. jbrown is selling copies 
like crazy. M$ can't understand why they aren't getting the money 
instead of jbrown. So they change the underlying software (windows)
so that jbrown's program no longer works. But, surprise, surprise, 
guess who has a "very similar" program that does work?

Of course, I'm not saying M$ would do something like that.
I agreed not to say anything bad about them before I even opened 
the software package - why is that sort of binding agreement totally 
illegal and unenforceable except when Micro$oft does it?

Maybe I ju$t an$wered my own que$tion.

Regards,
Irv

new topic     » goto parent     » topic index » view message » categorize

7. Re: Problem with binary files

A little off thread: When I searched the net for free windows-os clones,
most had no downloadable code, and the only one that was realy complete
was commercial and cost as much as M$ windows, with less features.
The only real alternative to M$ windows, as I see, would be something
like the long-gone generalwindows.com project: take Linux (or FreeBSD),
XFree86, and Wine, and set it up so that the os will load, run X,
and then X will load Wine, which in turn will load a bunch of free windows
programs that replace M$ ones. Wine isn't complete enough for this yet,
which is why generalwindows.com died off, I think. The next best thing
is Linux+XFree4.0+KDE2.1, which is what I use. After all, the only way
to beat M$ is to outdo them at their own game, i.e. have a clone of
M$ windows that is actually better.

jbrown

On Sun, Apr 29, 2001 at 04:24:10PM -0500, Irv Mullins wrote:
>=20
>=20
> On Sun, 29 Apr 2001, jbrown105 at HotPOP.com wrote:
>=20
> > > > IMHO, Microsoft is far too anti-POSIX. Why?
> > > >=20
> > > Isn't POSIX some kind of a standard?=20
> > > Doesn't that explain the M$ attitude?
> > >=20
> > > Regards,
> > > Irv
> >=20
> > Why?
>=20
> It's very simple, really. They (M$) will never support a standard that=20
> they don't control.  Controlling the standard means they can change=20
> it whenever they wish. Why would they want to do that? Let's just=20
> suppose, for example, that jbrown software comes out with a new=20
> program that everybody thinks is wonderful. jbrown is selling copies=20
> like crazy. M$ can't understand why they aren't getting the money=20
> instead of jbrown. So they change the underlying software (windows)
> so that jbrown's program no longer works. But, surprise, surprise,=20
> guess who has a "very similar" program that does work?
>=20
> Of course, I'm not saying M$ would do something like that.
> I agreed not to say anything bad about them before I even opened=20
> the software package - why is that sort of binding agreement totally=20
> illegal and unenforceable except when Micro$oft does it?
>=20
> Maybe I ju$t an$wered my own que$tion.
>=20
> Regards,
> Irv
>=20
>=20
>=20
>=20
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

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

new topic     » goto parent     » topic index » view message » categorize

8. Re: Problem with binary files

On Sun, 29 Apr 2001, jbrown105 at HotPOP.com wrote:

> A little off thread: When I searched the net for free windows-os clones,

No offense, but wouldn't a windows clone be about as desirable as 
a Rosie O'Donnell clone? Both are annoying and bloated....

> most had no downloadable code, and the only one that was realy complete
> was commercial and cost as much as M$ windows, with less features.
> The only real alternative to M$ windows, as I see, would be something
> like the long-gone generalwindows.com project: take Linux (or FreeBSD),
> XFree86, and Wine, and set it up so that the os will load, run X,
> and then X will load Wine, which in turn will load a bunch of free windows
> programs that replace M$ ones. Wine isn't complete enough for this yet,

Actually, it's just too slow. Too much emulation going on.

> which is why generalwindows.com died off, I think. The next best thing
> is Linux+XFree4.0+KDE2.1, which is what I use. After all, the only way
> to beat M$ is to outdo them at their own game, i.e. have a clone of
> M$ windows that is actually better.

Or perhaps a better GUI altogether. Windows is 20+ year old Xerox technology.

Regards,
Irv

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu