Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!unix.cis.pitt.edu!dsinc!ub!aquarium!ernie From: ernie@aquarium.buffalo.ny.us (Ernest J. Gainey III) Newsgroups: comp.sys.amiga.programmer Subject: Question About FileInfoBlock Structures Keywords: FileInfoBlock directories dos amigados Message-ID: <18a052ee.ARN02d3@aquarium.buffalo.ny.us> Date: 4 Feb 91 02:42:54 GMT Reply-To: ernie@aquarium.buffalo.ny.us Followup-To: comp.sys.amiga.programmer Organization: The Aquarium BBS (716)/999-9999 Lines: 116 Expires: Hello Everyone, I'm curious if anyone knows why this little bit of code produces such a strange result, from what I can tell, it should do a directory listing filename, filesize, and protections... Problem is... the fib_Protection field of the FileInfoBlock structure is Empty... when I print it as a "%d", i get a 0... all the other fields appear to have values... but do a... printf("Protection==%d\n",MyFileInfoBlock->fib_Protection); and I get a: Protection==0 ... Here, I'll include my little test program, and show ya... and maybe someone can figure out whats wrong... ----------------------- Cut Here Please :) -------------------------------- #include #include #include #include VOID DisplayFile(struct FileInfoBlock *MyFileInfoBlock) { char Protection[9]; int x; int Prot; static char *ProtectionNames[]= { "d","e","w","r","a","p","s"}; bzero(Protection,sizeof(Protection)); for (x=6; x>=0; x--) { if (MyFileInfoBlock->fib_Protection && (1<fib_FileName); if (MyFileInfoBlock->fib_DirEntryType>0) { printf("%6s ","Dir"); } else { printf("%6d ",MyFileInfoBlock->fib_Size); } printf("%s\n",Protection); } main(argc,argv) int argc; char *argv[]; { BPTR MyLock; struct FileInfoBlock *MyFileInfoBlock; int Success; if(!(MyFileInfoBlock=AllocMem(sizeof(struct FileInfoBlock),MEMF_PUBLIC))) { printf("Error Allocating FileInfoBlock\n"); exit(1); } if (argc<2) { MyLock=Lock("",ACCESS_READ); } else { MyLock=Lock(argv[1],ACCESS_READ); } if (MyLock==NULL) { printf("Error Achieving Lock\n"); exit(2); } Success=Examine(MyLock,MyFileInfoBlock); if (Success) DisplayFile(MyFileInfoBlock); do { Success=ExNext(MyLock,MyFileInfoBlock); if (Success) DisplayFile(MyFileInfoBlock); } while (Success); UnLock(MyLock); FreeMem(MyFileInfoBlock,sizeof(struct FileInfoBlock)); } ------------------ EOF -- Cut Here ---------------------------------------- Heres an example of the output: work Dir ------- dir.c 1443 ------- dir 6140 ------- test 0 ------- Thanks all for your help... Ernest J. Gainey III Home: ernie@aquarium.buffalo.ny.us //\\ The Amiga Aquarium School: gainey03@snybufva.bitnet //==\\ +1 716 999-9999 Snail :61 Tarkington,Tonawanda,NY 14150 \\// \\miga!