Yes, that is exactly the file struct. Now i try to access with Data Manager
functions. here is the coding
typedef struct {
DmOpenRef openRef;
UInt16 recordCount;
UInt16 recordIndex;
UInt16 offsetInCurrentRecord;
} sTempDB ;
static Err MyReadDBProc(void *dataP, UInt32 *sizeP, void *userDataP)
{
Err err = errNone;
sTempDB *pDB = (sTempDB *) userDataP;
MemHandle rechdl ;
MemPtr recptr;
if (pDB->recordIndex < pDB->recordCount)
{
rechdl = DmQueryRecord(pDB->openRef, pDB->recordIndex);
pDB->recordIndex ++;
if (rechdl==NULL)
{
err = DmGetLastErr();
ErrAlert(err);
}
else;
{
dataP = MemHandleLock(rechdl);
*sizeP = MemHandleSize(rechdl);
err = MemHandleUnlock(rechdl);
err = DmReleaseRecord(pDB->openRef, pDB->recordIndex, true);
}
}
return err;
}
beamthisapp
(
char *file_name, // File name to beam
)
{
UInt16 ret;
Err err = 0;
LocalID id;
UInt16 cardNumber = 0; // better not to hardcode this
sTempDB db;
// file. = file_name;
db.recordCount = 0; // set the start pos
db.recordIndex = 0; // set the start pos
db.offsetInCurrentRecord=0;
id = DmFindDatabase(cardNumber, file_name);
if (id)
{
db.openRef = DmOpenDatabase(0, id, dmModeReadOnly);
if (db.openRef== 0) // ERROR
{
err = DmGetLastErr();
ErrAlert(err);
}
else;
{
if (err == 0)
{
err = ExgDBRead(MyReadDBProc, NULL, &db, (LocalID *)id, 0,
false, true);
}
}
DmCloseDatabase(db.openRef);
}
}
and I get error NULL handle. What wrongs ? and How I can debug the MyReadDBProc
during the process ? Any idea. thanks
--
For information on using the Palm Developer Forums, or to unsubscribe, please
see http://www.palmos.com/dev/support/forums/