From bug-octave-request at bevo dot che dot wisc dot edu Thu Nov 12 17:50:06 1998 Subject: Octave v2.1.10 fread bug From: "John W. Eaton" To: William D Kirby Cc: "Report, Bug" Date: Thu, 12 Nov 1998 17:48:28 -0600 (CST) On 12-Nov-1998, William D Kirby wrote: | I had an m file that ran fine with version 2.0.13 that read a binary | data file with 80,000 16 bit ints with the following script | | num = fopen("test.pcm","rb"); | [x, c] = fread(num, inf, "short"); | | Version 2.1.10 reads in x with a size of 131072x1. The first 80,000 | values are correct, but the additional data are zero. The following is | required to get the exact 80,000 data samples needed. | | num = fopen("test.pcm","rb"); | [x, c] = fread(num, 80000, "short"); | | Shouldn't the "inf" notation read only to an end of file? Yes. Please try the following patch. Thanks, jwe Thu Nov 12 17:44:15 1998 John W. Eaton * dMatrix.cc (Matrix::read): Do the right thing for EOF when amount of data to read is unspecified. Index: dMatrix.cc =================================================================== RCS file: /home/jwe/src/master/octave/liboctave/dMatrix.cc,v retrieving revision 1.60 diff -c -r1.60 dMatrix.cc *** dMatrix.cc 1998/09/26 02:45:57 1.60 --- dMatrix.cc 1998/11/12 23:43:56 *************** *** 2617,2623 **** if (ok && skip != 0) is.seekg (skip, ios::cur); ! if (! ok) { if (is.eof ()) { --- 2617,2623 ---- if (ok && skip != 0) is.seekg (skip, ios::cur); ! if (! ok || is.eof ()) { if (is.eof ()) {