Hi!
I am writing a application that gets files from a FTP server.
If the file being downloaded is a pdb or prc file, the program must treat
the incoming bytes in a way. If the file is of any other kind, it is
considered a text file, and the program handles them in another way.
The problem is how to identify, based on the bytes being dowloaded, if the
file is a database or not.
Here is what I am trying: I am reading 'sizeof(DatabaseHdrType)' bytes
from the socket into a 'DatabaseHdrType' variable. But I do not know which
value should I check in against which field of 'DatabaseHdrType' to be
sure that it is really describing a database.
The 'DatabaseHdrType' is declared in 'PalmMemEquates.h' as:
typedef struct
{
UInt8 name[dmDBNameLength]; // name of database
UInt16 attributes; // database
attributes
UInt16 version; // version of
database
UInt32 creationDate; // creation date of
database
UInt32 modificationDate; // latest modification date
UInt32 lastBackupDate; // latest backup date
UInt32 modificationNumber; // modification number of
//
database
LocalID appInfoID; // application
specific info
LocalID sortInfoID; // app specific
sorting info
UInt32 type; // database type
UInt32 creator; // database creator
UInt32 uniqueIDSeed; // used to generate unique
IDs.
// Note
that only the low order
// 3
bytes of this is used (in
//
RecordEntryType.uniqueID).
// We are
keeping 4 bytes for
//
alignment purposes.
RecordListType recordList; // first record list
}
DatabaseHdrType;
Thanks,
Canellas
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/