chin@ankh.ftl.fl.us (Albert Chin) (06/01/90)
I am trying to do a GET_FILE_INFO using the <prodos.h> header and I am having problems. Here is what I do: ... FileRec fileinfo; ... strcpy(fileinfo.pathname,"/myfile"); GET_FILE_INFO(&fileinfo); printf("%u %u\n",fileinfo.fAccess,fileinfo.fileType); ... The problem is I keep getting 0 for fAccess and fileType regardless of the file I enter for [/myfile]. Can someone describe how to do this with both the <prodos.h> and <gsos.h> header files. Thanks, albert chin ... mthvax!mamia!albert
dlyons@Apple.COM (David A. Lyons) (06/27/90)
In article <348@ankh.ftl.fl.us> chin@ankh.ftl.fl.us (Albert Chin) writes: >I am trying to do a GET_FILE_INFO using the <prodos.h> header and I >am having problems. Here is what I do: > > ... > FileRec fileinfo; > ... > strcpy(fileinfo.pathname,"/myfile"); > GET_FILE_INFO(&fileinfo); > printf("%u %u\n",fileinfo.fAccess,fileinfo.fileType); > ... Assuming you have not assigned a value to the pathname field of fileinfo, your strcpy is wrong, because it's using a random value as the target address for the copy. If your have a hard-coded pathname, try: fileinfo.pathname = "\p*/system/desk.accs/my.desk.acc"; for example (the \p makes it a Pascal string, meaning that the first byte is a length count). If your string isn't hard-coded, then do something like: char myString[256]; ... fileinfo.pathname = myString; Copy your real string into myString at your convenience. -- David A. Lyons, Apple Computer, Inc. | DAL Systems Apple II Developer Technical Support | P.O. Box 875 America Online: Dave Lyons | Cupertino, CA 95015-0875 GEnie: D.LYONS2 or DAVE.LYONS CompuServe: 72177,3233 Internet/BITNET: dlyons@apple.com UUCP: ...!ames!apple!dlyons My opinions are my own, not Apple's.