fread with a pipe and a skip

Olaf Till olaf.till at uni-jena.de
Thu Mar 12 03:57:09 CDT 2009


On Thu, Mar 12, 2009 at 09:34:13AM +0100, Olaf Till wrote:
> 
> BTW I can not see an effect of skipping in writing to a file in 3.0.2:
> 
> octave:1> a = "1111111111111111";
> octave:2> length (a)
> ans =  16
> octave:3> b = "2222222222222222";
> octave:4> length (b)
> ans =  16
> octave:5> fid = fopen ("testfile", "w");
> octave:6> fwrite (fid, a);
> octave:7> fclose (fid);
> octave:8> system ("cat testfile");
> 1111111111111111octave:9> 
> octave:9> fid = fopen ("testfile", "w")
> fid =  3
> octave:10> fwrite (fid, b, "3*char", 1);
> octave:11> fclose (fid);
> octave:12> system ("cat testfile");
> 2222222222222222octave:13> 

Sorry, this part was nonsense, of course opening the file this way a
second time discards its previous contents. But:


octave:1> a = "1111111111111111";
octave:2> b = "2222222222222222";
octave:3> fid = fopen ("testfile", "w");
octave:4> fwrite (fid, a);
octave:5> fseek (fid, 0)
ans = 0
octave:6> fwrite (fid, b, "3*char", 1);
octave:7> fclose (fid);
octave:8> system ("cat testfile");
2222222222222222octave:9> 

shows also no effect of skipping ...


More information about the Bug-octave mailing list