'=========================================================================== ' Subject: ABC FILE STRUCTURES Date: 02-25-96 (10:42) ' Author: The ABC Programmer Code: QB, QBasic, PDS ' Origin: The ABC Reader v1.00 Packet: ABC.ABC '=========================================================================== ' Here is the release of the ABC Packet structures TYPE ABCFileStructure ' Structures for *.ABC From AS STRING * 31 ' Programmer/Author's name Subject AS STRING * 31 ' Subject/Title of code Origin AS STRING * 31 ' Origin of code, or keywords DateOf AS STRING * 23 ' Date of code release CodeOf AS STRING * 23 ' Code of (QB,QBasic,PDS,ASIC,PB,VB,ASM,TEXT) NumLines AS STRING * 5 ' Number of lines in code NumBytes AS STRING * 9 ' Number of bytes when extracted SaveFile AS STRING * 12 ' Default extraction name END TYPE ' NOTE: (Number of bytes) - (Number of lines in code) = (Bytes in Packet) ' ' Lines are deliminated by CHR$(227) therefore reducing [CR,LF] to just one ' byte. Note that the stucture is NOT similar to the .QWK packets. ' Please do not use their structure or method of reading the ABC packets. ' ' For best results, read blocks in 250 bytes. 4096 bytes would be best ' if you decide to transfer them directly into the memory buffer. ' ' NOTE: DO NOT read them into a string array, unless you know how to ' free up LOTS of memory (XMS/EMS) just use file pointers (LONG). DIM ABCIndex AS STRING * 78 ' For the .IDX files, here's the structure: ' ' First character is NULL or a "û" for NEW or a "¯" for SPECIAL (Your code) ' ' Next 10 bytes are the position for the code in the .ABC counterpart. ' Next 5 bytes are the number of lines in the file ' Next 31 bytes are the Subject/Title of the code ' Last 31 bytes are the Author/Programmer's Name ' ' TYPE ABCIndexStructure ' Code AS STRING * 1 ' Position AS STRING * 10 ' NumLines AS STRING * 5 ' Subject AS STRING * 31 ' From AS STRING * 31 ' END TYPE ' Here's a short demostration on reading the INDEX and ABC Packet ' Make sure the following packets are in your current directory ' or change the path to compensate. CLS ABCFile$ = "GRAPHICS.ABC" ' Choose an appropriate packet IndexFile$ = "GRAPHICS.IDX" ' and make sure they exist. OPEN IndexFile$ FOR BINARY AS #1 ' Open the .IDX file GET #1, , ABCIndex ' Get first record (Nah, too easy, always 1) PRINT ABCIndex ' Display GET #1, , ABCIndex ' Second record (Nah, let's go deeper) PRINT ABCIndex ' Display GET #1, , ABCIndex ' Third record (OK, we'll use this for our DEMO) PRINT ABCIndex ' Display CLOSE #1 Position& = VAL(MID$(ABCIndex, 2, 10)) ' Get our .ABC byte position ' ^Since the first byte is the Code chr ' We must skip to the second byte and read ' 10 characters from the string ABCIndex ABCHeader$ = SPACE$(165) ' Total number of bytes in header is 165 ' Don't normally use this, only for DEMO ' purposes. OPEN ABCFile$ FOR BINARY AS #1 ' Open the .ABC file GET #1, Position&, ABCHeader$ ' Goto Position& and read contents PRINT ABCHeader$ ' Display it, yes, it works! CLOSE #1 ' I'll leave the hard part (parsing the lines of code) up to you :) ' ' Remember: TotalBytes& = VAL(NumBytes) - VAL(NumLines) ' ' Parse in 250 byte blocks ... until you over shoot TotalBytes& ' Use INSTR to find CHR$(227) and store pointers in LONG INTEGER arrays ' ' Piece of cake! Good luck and happy programming!