From bug-octave-request at bevo dot che dot wisc dot edu Fri Jul 18 13:22:30 2003 Subject: FWRITE writes extra bytes (OfW 2.1.42) From: =?ISO-8859-1?Q?Alois_Schl=F6gl?= To: bug-octave at bevo dot che dot wisc dot edu Date: Fri, 18 Jul 2003 09:12:37 -0500 To: bug-octave at bevo dot che dot wisc dot edu Cc: schloegl Subject: bug in fwrite (OfW 2.1.42) -------- Bug report for Octave 2.1.42 configured for i686-pc-cygwin (I used a version from octave-forge) Description: ----------- FWRITE writes extra bytes Repeat-By: --------- ####### The following script shows the problem. x=(1:1e3)'*ones(1,5); % test data fid = fopen('test.tmp','w+'); count=0; for k = 1:10, c=fwrite(fid,x(k*100+(-99:0),:),'int16');; count=count+c; tmp(k,:)=[2*count,ftell(fid)]; end; fclose(fid); tmp, ######## The result is tmp = 1000 1000 2000 2005 3000 3005 4000 4010 5000 5010 6000 6011 7000 7015 8000 8016 9000 9020 10000 10020 ##### Both columns should be the same, but the second column shows extra bytes were written. Fix: --- Not known, but it seems as if 0x0A is extended to 0x0D 0x0A, which causes extra bytes. ------------------------------------------------------------- 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 -------------------------------------------------------------