From bug-octave-request at bevo dot che dot wisc dot edu Sun Dec 21 10:04:42 2003 Subject: Re: ftell - position of file pointer cannot be tested From: "John W. Eaton" To: Schloegl Alois Cc: "John W. Eaton" , bug-octave@bevo.che.wisc.edu Date: Sun, 21 Dec 2003 09:47:35 -0600 On 20-Dec-2003, Schloegl Alois wrote: | Let me get this right. | You are saying, it is not possible anymore to implement something like this? | | fid = fopen(anyfile,'r'); | s=fread(fid,10,'char'); % simple command, can be much more complicated, too. | pos = ftell(fid); | if pos == 10, | 'postion is OK', | else | 'position is not correct', | end; | fclose(fid); % never forget to close a file. Right. All you can do is ask for the current position in the file, increment or decrement it by some amount and compare to another stored position. Again, I think most of this was discussed in a previous thread on the octave-maintainers list. If you'd like to pick up that discussion again, then I think that's the appropriate forum for it. I believe the reasons for the change were explained in greated detail there, but the central reason is that we will eventually want support for large files, and more recent versions of C++ don't provide the functionality you want for the stream classes. I'd like to be able to also support the old way of doing things, but I don't see a clean way to do it. So, rather than just complaining, it would be much more helpful if you could provide some constructive solutions if you can see a way to work around the problem. | In other words, the position of the file pointer does not "Return | the position of the file pointer as the number of characters from | the beginning of the file FID" (quoted from help ftell). The docs are out of date (sorry). jwe ------------------------------------------------------------- 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 -------------------------------------------------------------