Hello All,
Well am using the following code:-
Inputstring :-"00001~VIKAS~VIKAS"
extern Err getSalPersonStructPtrFromString(const char *
p_Str_FormattedStr,SalPersonLoginInfoPtr p_SalStruct)
{
char * temp = NULL;
char ** p_Str_Array = (char **)MemHandleNew(sizeof(char*));
MemHandleLock((MemHandle)p_Str_Array);
for(int i = 0 ,j = 0, k = 0; i < StrLen(p_Str_FormattedStr) ; i++)
{
if(i == 0)
{
temp = (char *)MemHandleNew(sizeof(char));
UInt32 size = MemHandleSize((MemHandle)temp);
MemHandleLock((MemHandle)temp);
}
if(p_Str_FormattedStr[i] =='~' )
{
*(temp +k) = '\0';
p_Str_Array[j] = temp;
MemHandleUnlock((MemHandle)temp);
temp = NULL;
temp = (char *)MemHandleNew(sizeof(char));
MemHandleLock((MemHandle)temp);
j++;
k=0;
}
else
*(temp+k ) = *(p_Str_FormattedStr+i); // ##################
Memory Error at this line #############//
k++;
}
}//End for
p_SalStruct =
(SalPersonLoginInfoPtr)MemPtrNew(sizeof(SalPersonLoginInfoStruct));
p_SalStruct->p_str_ID = p_Str_Array[0];
p_SalStruct->p_str_Name = p_Str_Array[1];
p_SalStruct->p_str_Password = p_Str_Array[2];
MemHandleUnlock((MemHandle)p_Str_Array);
return errNone;
}//End function
Can anybody help me out as to why am i getting memory error at this line..I
hope my memory allocation
is perfect.
Regrads,
Vikas Lakkashetti
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/