a couple of random questions

Stephen J. Friedl friedl at vsi.UUCP
Fri Apr 15 11:23:26 AEST 1988


In an article, davidsen at steinmetz.ge.com (William E. Davidsen Jr) writes:
< In the first article  friedl at vsi.UUCP (Stephen J. Friedl) writes:
< |      Second, what is the portable way to rewind a Unix file
< | descriptor?  On almost every machine I have ever used:
< | 
< |         lseek(fd, (off_t)0, SEEK_SET);
< 
< Any implementation which doesn't use 
< 	lseek(int, long, int)
< In the K&R manner (pg 164) will break virtually every program which uses
< the feature. I have to check dpANS on this, or someone can post and tell
< me that they found some way to justify doing something else.

I believe that dpANS does not address lseek(2) because it is an
operating system function; they specify fseek(3) instead, where
the offset is defined to be in characters.  Presumably the stdio
library is required to "just figure it out" on a record-based
system.  I've seen it written somewhere that the only portable
way to get an lseek(2) offset is as a result from a previous lseek(2).

-- 
Steve Friedl   V-Systems, Inc.   "Yes, I'm jeff at unh's brother"
friedl at vsi.com  {backbones}!vsi.com!friedl  attmail!vsi!friedl



More information about the Comp.lang.c mailing list