Path: utzoo!attcan!uunet!cs.utexas.edu!tut.cis.ohio-state.edu!bloom-beacon!gatech!udel!new From: new@udel.EDU (Darren New) Newsgroups: comp.sys.amiga.tech Subject: Re: help: read file date Message-ID: <14055@louie.udel.EDU> Date: 27 Apr 89 00:35:00 GMT References: <8990002@hprmokg.HP.COM> Sender: usenet@udel.EDU Reply-To: new@udel.EDU (Darren New) Organization: University of Delaware Lines: 64 In article <8990002@hprmokg.HP.COM> alh@hprmokg.HP.COM (Al Harrington) writes: >A friend of mine needs to read the date of a file (he's writting a BBS) >using Manx C. Simple!!! (yeah, sure, once you've done it already) Lock() the file, and then Examine() it. Look at the datestamp in the FileInfoBlock returned by Examine. Don't forget to UnLock() the file. See DOS DateStamp() function description for information on how to interpret the values in the DateStamp structure. This should work regardless of the compiler, as it is all AmigaDOS. If you are scanning a directory (like LIST does), you don't have to individually lock the files because the ExNext call returns the fib for the file you want. Below is something I just typed in, so there may be minor typos. Also, I leave it up to you to track down all the #%@$# includes you need to do this :-). (In case you don't have DateStamp description, ds_Days is days since some particular day which I don't remember offhand but could find out for you, ds_Minute is minutes since midnite of ds_Days, ds_Tick is ticks (50/sec) since ds_Minute, which I'm not sure ever works right.) extern day, minute, tick; int GetDateFromFile(fname) char * fname; { BPTR lck; struct FileInfoBlock * fib; fib = (struct FileInfoBlock *) AllocMem(sizeof(struct FileInfoBlock), MEMF_PUBLIC); if (fib == NULL) return 0; lck = Lock(fname, ACCESS_READ); if (lck == NULL) { FreeMem(fib, sizeof(...)); return 0; } if (!Examine(lck, fib)) { UnLock(lck); FreeMem(fib, ...); return 0; } day = fib->fib_DateStamp.ds_Days; minute = fib->fib_DateStamp.ds_Minute; tick = fib->fib_DateStamp.ds_Tick; UnLock(lck); FreeMem(fib, ...); return 1; } ------- End of Unsent Draft