From octave-maintainers-request at bevo dot che dot wisc dot edu Fri Jan 23 14:06:33 2004 Subject: Re: file offsets used by fseek and ftell From: Alois Schloegl To: "John W. Eaton" CC: octave-maintainers at bevo dot che dot wisc dot edu, bug-octave@bevo.che.wisc.edu Date: Fri, 23 Jan 2004 20:59:09 +0100 John W. Eaton wrote: >On 23-Jan-2004, Alois Schloegl wrote: > >| The natural representation of the position of a file pointer is a >| numeric value. > >I would think it would be a marker of some sort, but a number does not >necessarily work. > Is not an integer value equivalent to a marker ? >What does it mean? > As you say below, its simply the number of bytes from the beginning of the file. That's as much of a meaning I want to assign - not more. >Is it the number of bytes or >characters (what are they, and what if a file is a mixture of >different character widths) etc. > I'm working with all kind of file types ascii, binary, mixed type. A list of many different file formats is available from http://www.dpmi.tu-graz.ac.at/~schloegl/matlab/eeg/ For many of them, the format specification is included. The binary files can contain different word length (e.g alpha and MIT/BIH can have 12bit words, BDF has 24bit words, EDF has an ASCII header and binary data blocks, etc) The only thing all file formats have in common is, how they measure the filesize. All of them use the unit "Byte" to measure it. Moreover, if you want to read a junk of data without loading the whole file (very important for large data), you need to know the exact position - in bytes, of course. >Also, as I understand it, the >"number of bytes" from the beginning of the file may not be meaningful >because of things like end-of-line translation, etc. > ftell and fseek are very important to overcome these difficulties. They can be very powerful tools to access a huge variaty of file formats. Limiting the power of these tools (e.g. by making it impossible to do arithmetic operations with the file position) limits also the power of the language. >I think that >these are other reasons for making streampos something that you can't >look at as an integer. > > I'm afraid, I do not understand what you mean. . Alois