help-octave
[Top][All Lists]
Advanced

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

Re: binary file format??


From: John W. Eaton
Subject: Re: binary file format??
Date: Wed, 17 Jun 1998 15:08:03 -0500 (CDT)

On 10-Jun-1998, Kai Mueller <address@hidden> wrote:

| On Wed, Jun 10, 1998 at 01:17:51PM -0600, Rusty Boyd wrote:
| > What is the file format used when using the 'fwrite' function, or, more to 
the   
| > point, how can I read a file created with this function using a 'C' 
program. I   
| > have tried every precision type listed, but after about 30 or so items from 
a   
| > column vector, the numbers start making no sense (to me). For example, 
instead   
| > of 0xFFFF, the file will contain FFDF, or, instead of 0x000E, it will be   
| > 0x00E0. 
| > Thanks in advance, 
| > Rusty 
| > 
| 
| Octave example:
|   a =
| 
|     1  2  3
|     4  5  6
|     7  8  9
| 
| 
|   octave:8> fwrite(fn,a,"double")
|   ans = 9

Also, as I think someone mentioned in another thread, you may need to
open the file in binary mode on non-Unixy systems for this to be
successful.  For example, use

  fn = fopen ("file", "wb");

instead of just

  fn = fopen ("file", "w");

Perhaps this is why you get incorrect results after a number of values
have been written?

jwe



reply via email to

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