From: Shawn Hargreaves Newsgroups: comp.os.msdos.djgpp Subject: Re: Allegro: pack_fread() Date: Fri, 30 Jan 1998 19:34:32 +0000 Organization: None Distribution: world Message-ID: <53L9ZRAIti00EwMv@talula.demon.co.uk> References: NNTP-Posting-Host: talula.demon.co.uk MIME-Version: 1.0 Lines: 57 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Matt Riker writes: >Even after reading the area of the manual several times, I'm not sure >how to use pack_fread(). My question is, can you use pack_fread() on >any file, or does it have to be a packfile? You can read any disk file with the Allegro functions, regardless of how this file was created in the first place, but you must never try to mix the Allegro code with stdio routines. For example you cannot call the libc fopen() function to obtain a FILE *, and then try to use pack_fread() with that. When you are using the Allegro code you have to call pack_fopen() to obtain a PACKFILE *, which you can then access with the pack_fread() routine and destroy by calling pack_fclose(). >My understanding is that a packfile is a compressed file, which isn't >what I'm interested in. I wrote that code mainly to handle compressed data, but the functions are also capable of reading from normal disk files (pass F_READ, rather than F_READ_PACKED, to the pack_fopen() function), datafile objects (accessed using a fake filename in the form "datafile.dat#object_name"), and data that has been appended onto your executable with the exedat utility (accessed using the magic "#" filename). If you don't need any of these special features, there is no point in using the Allegro code, and you should stick with the normal stdio routines. >Also, could someone please demonstrate how to use pack_fread()? To read 256 bytes of data into an array: char buf[256]; pack_fread(buf, 256, f); Look at the pack.c utility for a more complete example of how to use these routines. >____________________________ >Matt Riker >SPAMGUARDriker AT pipcom DOT com >*** Remove SPAMGUARD *** >*** when replying! *** This issue has already been discussed elsewhere (incidentally it was great to see how many people agreed with me that these addresses are obnoxious!) but I'd just like to repeat my opinion for you personally. I have already answered several of your questions here in this group, and will be very happy to continue doing so in the future, but I already spend enough time doing this kind of voluntary "tech support" work that I resent having to waste my time noticing and editing your return address, or deleting messages when they bounce back to me. So I think it is only fair to let you know that unless you provide a valid address that I can reply to, I will not be responding to any of your posts from now on... -- Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/ "Pigs use it for a tambourine" - Frank Zappa