[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: file offsets used by fseek and ftell
From: |
Alois Schloegl |
Subject: |
Re: file offsets used by fseek and ftell |
Date: |
Fri, 23 Jan 2004 20:59:09 +0100 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) |
John W. Eaton wrote:
On 23-Jan-2004, Alois Schloegl <address@hidden> 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