Path: utzoo!attcan!uunet!wuarchive!psuvax1!rutgers!cbmvax!ken From: ken@cbmvax.commodore.com (Ken Farinsky - CATS) Newsgroups: comp.sys.amiga.tech Subject: Re: FileInfoBlock Keywords: FileInfoBlock write protection date Message-ID: <15413@cbmvax.commodore.com> Date: 26 Oct 90 14:29:48 GMT References: Reply-To: ken@cbmvax.commodore.com (Ken Farinsky - CATS) Distribution: comp Organization: Commodore, West Chester, PA Lines: 56 In article phil@adam.adelaide.edu.au (Phil Kernick) writes: >If I use the following stub of code: > >getinfo() >{ > BPTR fred; > struct FileInfoBlock *fib; > > lock = Lock("fred", ACCESS_READ); > Examine(lock, fib); >} AACK!! You have to allocate the memory for the file info block. something like: if (NULL != (fib = (struct FileInfoBlock *) AllocMem(sizeof(*fib),MEMF_CLEAR | MEMF_PUBLIC))) { /* use the fib here */ FreeMem(fib, sizeof(*fib)); } Note that AllocMem() guarantees longword alignment. Sorry for any errors, I'm doing this from memory. Here's the info on Examine(): SYNOPSIS success = Examine( lock, infoBlock ) D0 D1 D2 BOOL success; struct FileLock *lock; struct FileInfoBlock *infoBlock FUNCTION Examine() fills in information in the FileInfoBlock concerning the file or directory associated with the lock. This information includes the name, size, creation date and whether it is a file or directory. FileInfoBlock must be longword aligned. Examine() gives a return code of zero if it fails. You may make a local copy of the FileInfoBlock, as long as it is never passed back to the operating system. INPUTS lock - BCPL pointer to a lock infoBlock - pointer to a FileInfoBlock (must be longword aligned) OUTPUTS success - boolean -- -- Ken Farinsky - CATS - (215) 431-9421 - Commodore Business Machines uucp: ken@cbmvax.commodore.com or ...{uunet,rutgers}!cbmvax!ken bix: kfarinsky