Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!ucbvax!dog.ee.lbl.gov!ux5.lbl.gov!beard From: beard@ux5.lbl.gov (Patrick C Beard) Newsgroups: comp.sys.mac.programmer Subject: Re: Think C Unix library missing stat call Keywords: mac c think unix Message-ID: <12430@dog.ee.lbl.gov> Date: 24 Apr 91 15:52:26 GMT References: <2949@cirrusl.UUCP> Reply-To: beard@ux5.lbl.gov (Patrick C Beard) Organization: Berkeley Systems, Inc. Lines: 20 X-Local-Date: Wed, 24 Apr 91 08:52:26 PDT In article <2949@cirrusl.UUCP> local%cirrusl@oliveb.ATC.olivetti.com (local user(me)) writes: #I was recently trying to port a Unix program ('patch', actually) #to Think C, and discovered then that the Unix library doesn't emulate either #the 'stat' routine or the 'access' routine, both of which are extremely # common in Unix programs. I realize that there are ways of doing these things #with Mac system calls, but if I wanted to rewrite the whole program I wouldn't #be using the ANSI/unix libraries anyway. Does anyone know of a more complete #set of emulated Unix calls for Think C? I've encountered this when porting unix code myself. See what is needed in the stat call. In almost every case the information sought after has been the logical length of the file. This is something you can get with lseek (which is a unix call). I'm not sure what else stat returns, but it shouldn't be hard to write your own version of the call that uses lseek to get the size, and some other call to fill in the rest. -- // Patrick C. Beard, Software Engineer, Berkeley Systems, Inc. // "Heroes of technology." // beard@lbl.gov, d0346@applelink.apple.com (ATTN: Patrick)