That error could be StrLen complaining or StrCopy complaining.
I would separate out your compound phrase in the MemPtrNew call to something like:
Char* rec = ReadRecord(className, i);
if(rec)
{
len = StrLen(rec) + 1;
cL[i] = MemPtrNew(len);
if(cL[i])
StrCopy(cL[i], rec)
}
...
IMHO, this code makes it much more clear what is giving you the problem.
Kevin
-----Original Message-----
From: Low Pui Kuen [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 15, 2002 7:07 AM
To: Palm Developer Forum
Subject: Null string happened on real palm but 'ok' in emulator
Hi,
I am running a strange problem or something I had never encountered before.
When I run on the real palm, I got an error called NULL string passed. But
it runs successfully in my emulator.
After several of troubleshooting,
I found the problem in lies in this function
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
static void GetClassList(Char *cL[])
{
#define noRecord -1
int i, j;
UInt16 totalRecords;
Char *className = {"NPET-Class"};
totalRecords = CountRecord(className);
if( totalRecords != noRecord)
{
for(i = 0; i < totalRecords ; i++)
{
cL[i] = MemPtrNew(StrLen(ReadRecord(className, i) + 1));
//remeber to
free
StrCopy( cL[i] , ReadRecord(className,i));
}
CloseDB();
setDBPtr(); //act as a separator
for( j = i + 1; j < MAXOFCLASS; j++)
*cL[j] = NULL;
}
else
;
//Tell the user to setUP the record
}
If I comment out the StrCopy, it runs fine on the real palm.
I have checked that I am able to get the string passed from the ReadRecord.
I am using Palm IIIe and emulator is Palm V
SDK 4.0;
Is it something wrong with my StrCopy or cL[]? Thanks in advance.
Low Pui Kuen
_________________________________________________________________
Join the world's largest e-mail service with MSN Hotmail.
http://www.hotmail.com
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/