| Hello, I'm new to both C and programming on the palm. I've run into a problem when trying to create a record in my database. Here is the code: static Boolean OpenDatabase(void) { bool DBnoError; bool error = false; LocalID dbID; UInt16 attributes; UInt16 dbVersion; UInt16 index = 1; MemHandle UserRecordH; UserRecord *UserRecordP; UserRecord UserRecord; LoTiObserverDB = DmOpenDatabaseByTypeCreator(LoTiObserverDBType, LoTiObserverAppID, dmModeReadWrite); if (! LoTiObserverDB) { DBnoError = DmCreateDatabase (0, LoTiObserverDBName, LoTiObserverAppID, LoTiObserverDBType, false); if (DBnoError) { LoTiObserverDB = DmOpenDatabaseByTypeCreator(LoTiObserverDBType, LoTiObserverAppID, dmModeReadWrite); if (! LoTiObserverDB) error = true; } else { error = true; } } // Set the backup bit. This allows for the database to be backed up if // the user does not have the LoTi Observer conduit installed. DmOpenDatabaseInfo(LoTiObserverDB, &dbID, NULL, NULL, 0, NULL); DmDatabaseInfo(0, dbID, NULL, &attributes, NULL, NULL,NULL, NULL, NULL, NULL, NULL, NULL, NULL); attributes |= dmHdrAttrBackup; // Set the database version. dbVersion = 1; DmSetDatabaseInfo(0, dbID, NULL, &attributes, &dbVersion, NULL,NULL, NULL, NULL, NULL, NULL, NULL, NULL); // Create a record. **HERE IS WHERE THE PROBLEM IS** UserRecordH = DmNewHandle(LoTiObserverDB, sizeof(UserRecord)); UserRecordP = MemHandleLock(UserRecordH); //<<----This is the line that generates a compile error. DmWrite(UserRecordP, 0, &UserRecord, sizeof(UserRecord)); MemHandleUnlock(UserRecordH); DmAttachRecord(LoTiObserverDB, &index, UserRecordH, NULL); return (error); } Here is the struct "UserRecord": typedef struct { UInt16 RecordID; UInt16 DateCreated; UInt16 DateObserved; UInt16 DateFinished; bool SettingA1; bool SettingA2; bool SettingA3; bool SettingA4; //char SettingOth[]; char userName[]; } UserRecord; Global Variables: #define LoTiObserverDBType 'Data' #define LoTiObserverAppID 'LoTi' char LoTiObserverDBName[] = "LoTiObserverDB"; DmOpenRef LoTiObserverDB; int NextForm; int LastForm; The part of code that is causing the error is when I'm trying to create a new Handle using "DmNewHandle". It seems to fail. The compile error I get is "Illegal implicit conversion from 'void *' to "UserRecord *'". Which means that the Handle "UserRecordH" must be void and therefore wasn't created properly. My question is what am I doing wrong? I don't understand why it is failing here. All help will be greatly apreciated. Hopefully I have provided you with enough source to find my problem. Thanks You, -Nathan -- For information on using the PalmSource Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/ |
- I Need Help with a Compile Error cuased by "DmNewHandle... Nathan Fisher
