Reading binary data.

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Reading binary data.

Randall M. Brannan
I'm new to this list so please forgive me for asking a question which
may have already been covered.  Can Octave read a binary data file?  
The 200 page Octave manual indicates that fread will read binary data
but that the binary file must first be opened by fopen.  The problem
is that the manual entry for fopen only allows text files.  I've tried
playing with fopen and fread in various ways but fread always returns
a count of zero.  I'm running on a SPARC-10 using the precompiled code
I downloaded from:
ftp.che.utexas.edu:/pub/octave/BINARIES/sparc-sun-sunos4.1.2
  The manual also indicates you can simply give the filename to fread
rather than the file-id returned from fopen.  I tried that and it still
gave me count=zero.

                                        Thanks in advance,
                                        R. Brannan
                                        [hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: Reading binary data.

Vinayak Dutt
#I'm new to this list so please forgive me for asking a question which
#may have already been covered.  Can Octave read a binary data file?  
#The 200 page Octave manual indicates that fread will read binary data
#but that the binary file must first be opened by fopen.  The problem
#is that the manual entry for fopen only allows text files.  I've tried
#playing with fopen and fread in various ways but fread always returns
#a count of zero.  I'm running on a SPARC-10 using the precompiled code
#I downloaded from:
#ftp.che.utexas.edu:/pub/octave/BINARIES/sparc-sun-sunos4.1.2
#  The manual also indicates you can simply give the filename to fread
#rather than the file-id returned from fopen.  I tried that and it still
#gave me count=zero.
#

 i have used fopen() to open a binary file. fopen() should open any type of file,
not just text file.

you would require octave version 1.1 to read binary files though (using fread()).




--vinayak-
/*
 * vinayak dutt
 * graduate student, ultrasound research
 * mayo graduate school, rochester mn
 *
 * e-mail: [hidden email]
 *         [hidden email]
 *
 */
#include "disclaimer.h"