[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Writing binary files is not working properly
From: |
robert Macy |
Subject: |
Re: Writing binary files is not working properly |
Date: |
Sat, 25 Oct 2003 16:29:13 -0700 |
I think you found it.
Ok, so how do I open the file in "binary" mode?
I have Borland C++ and Microsoft Visual C++ on this machine
but haven't successfully run anything using it. The last
attempt at compiling something - Yorick - was such a
disaster, I'm ready to uninstall all of C++ stuff.
Does Octave have some way to open a file in binary mode,
like simply force the issue?
- Robert -
On Sat, 25 Oct 2003 14:50:35 -0400
Doug Stewart <address@hidden> wrote:
>
>
> Geraint Paul Bevan wrote:
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> >
> > robert Macy wrote:
> >
> > | In other words, fwrite(fid,sig,'ushort'); is adding a
> > | "carriage return" everytime the data has "new line"
> > |
> >
> > Looks like your problem could be due to the way various
> operating
> > systems mark the end of lines in text files
> >
> > unix: linefeed
> > max: carriage return
> > dos: carriage return and linefeed
> >
> > There are utilities available that can convert files
> from one form to
> > the other: http://www.google.com/search?q=dos2unix
>
> These will not work for a binary file.
>
> There real problem is that when opening a file in "C", to
> write a wave file, on a windows machine, you must open
> it in binary mode. You can write the data out in text
> mode or binary mode, but the text mode adds the extra LF
> for each CR.
>
> So I haven't looked at the code in octave, but I do have
> my students write a wave file from "C" every year, so I
> have seen your problem every year.
>
> Doug Stewart P.Eng.
>
>
>
>
> >
> > - --
> > Geraint Bevan
> > http://homepage.ntlworld.com/geraint.bevan
> >
> > -----BEGIN PGP SIGNATURE-----
> > Version: GnuPG v1.2.3 (GNU/Linux)
> > Comment: Using GnuPG with Mozilla -
> http://enigmail.mozdev.org
> >
> >
>
iEYEARECAAYFAj+arp4ACgkQcXV3N50QmNOwzwCgh1oI4PYc0sSWzNAzoe9Lr6Gj
> > ghQAn0qIv9NHrd/vf8NmW1LYGzzRSHfj
> > =vHFB
> > -----END PGP SIGNATURE-----
> >
> >
> >
> >
>
-------------------------------------------------------------
> > Octave is freely available under the terms of the GNU
> GPL.
> >
> > Octave's home on the web: http://www.octave.org
> > How to fund new projects:
> http://www.octave.org/funding.html
> > Subscription information:
> http://www.octave.org/archive.html
> >
>
-------------------------------------------------------------
> >
> >
>
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------