help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Writing binary files is not working properly


From: Doug Stewart
Subject: Re: Writing binary files is not working properly
Date: Sat, 25 Oct 2003 14:50:35 -0400
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.2.1) Gecko/20021130



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
-------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]