[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

file-position function



Dear clispers,

  When I use the file-position function, there seems to be something 
different from the description in CLtR. In CLtR, the usage for 
file-position is:

   file-position file-stream [position]

and if the "position" argument is specified, the position is set to its
value and "t" is returned. A value of nil is returned if the file position
cannot be set to the value specified by "position".

However, the following results show the difference, where the file "foo"
contains only ten characters, i.e. "1234567890":

> (setq in (open "foo"))
#<STRING-CHAR-FILE-STREAM #"FOO">
> (read in)
1234567890
> (file-position in)
10
> (read in)
*** - READ: input stream ... has reached its end

> (file-position in 0)
T
> (file-position in 10)
T
> (file-position in 11)
*** - connot position #<STRING-CHAR-FILE-STREAM #"FOO"> beyond EOF
1. Break>


Is there something wrong with the usage? I'd like that it returns the nil
when the file position cannot be set.

Sincerely yours,
Chun-Yu Lee.
E-mail: d791013@ce.ntu.edu.tw