Path: utzoo!mnetor!uunet!vsi!friedl From: friedl@vsi.UUCP (Stephen J. Friedl) Newsgroups: comp.lang.c Subject: Re: a couple of random questions Message-ID: <541@vsi.UUCP> Date: 15 Apr 88 01:23:26 GMT References: <530@vsi.UUCP> <10426@steinmetz.ge.com> Distribution: comp Organization: V-Systems, Inc. -- Santa Ana, CA Lines: 23 In an article, davidsen@steinmetz.ge.com (William E. Davidsen Jr) writes: < In the first article friedl@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@unh's brother" friedl@vsi.com {backbones}!vsi.com!friedl attmail!vsi!friedl