[comp.windows.ms] C A R D F I L E Format

Renee@cup.portal.com (Renee Linda Roberts) (10/16/90)

                      Microsoft Application Note

                        Cardfile File Format

The Cardfile file format is as follows:

Byte #	Description

0 - 2	"Signature bytes --- always ""MGC"" (4D 47 43) "	
3 - 4	Number of cards in file 
 						
Beyond the first five bytes are the index lines --- the
information about the top line of each"card.  The first
index entry begins at byte #5 in the file, and successive
entries begin 34 bytes after the beginning of the last index
entry (the second entry at byte #39, the third entry at byte
#6D, etc.).  The format for each index line entry is as
follows: 

0 - 5	Null bytes, reserved for future use (should all be 00)
6 - 9	Absolute position of card data in file 	
A		Flag byte (00) 
B - 32	Index line text 
33		Null byte ; indicates end of index entry 

After the last index entry, each card's data is stored. 
Card data will be in one of four general formats: graphic
and text, text only, graphic only, and blank.  Blank cards
consist of four null bytes; the other card formats are
below:
 						
Graphic	Text		Graphic 
& Text	Only		Only 
0 - 1	 0 - 1#	0 - 1	Length of graphic bitmap. #
2 - 3        *		2 - 3	Width of graphic.  *
4 - 5	   *		4 - 5	Height of graphic.  *
6 - 7	   *		6 - 7	X-coordinate of graphic.  *
8 - 9	   *		8 - 9	Y-coordinate of graphic.  *
A - x	   *		A - x	Bitmap of graphic.  *	
x+1 - x+2	 2 - 3    x+1 - x+2#Length of text entry.  #	
x+3 - y    	4 - z	*	Text.  *	
 						
x = 9 + length of bitmap 
# - Bytes are null if no bitmap/text
y = x + 2 + length of text entry 	
* - Bytes don't exist if no bitmap/text	
z = 3 + length of text entry 	
 						
The first byte of any card's data entry is pointed to by
bytes 6-9 in the index entry.  Note that no null byte is
used to indicate the end of the card's data entry; the next
card's data entry immediately follows the last byte of the
previous entry, which will be null only if the previous card
has no text (null length of text entry).
 			
All numbers in this document, including those in the
descriptive text, should be interpreted as hexadecimal
numerals.  All data pointers and count bytes in the file are
unsigned binary/hexadecimal integers in least- to most
significant format.  All text in the file is saved in low
ASCII format.  In the text section of a card's data, <CR> is
always followed by <LF>.