The code below has eluded me for quite awhile now and I have given up on how to perform a simple task like getting a string from a record into a text field due to the complete lack of documentation by Palm. This is really a C issue rather than Palm but as Palm is all about databases one would think that displaying the data would be a priority. The problem is with StrCopy and no matter what I do I get all these stupid errors like char* to struct_opaque* etc when trying to complie. Any help greatly appreciated.
static void ActionLoadRecords (FormPtr frm)
{
FieldPtr fld;
MemHandle h;
Char* buffer;
Char place[90];
WChar outChar;
UInt16 index;
UInt32 inOffset = 0;
DmOpenRef gDB = 0;
UInt16 length;
UInt16 b;
index = 1;
h = DmQueryRecord(gDB, index);
buffer = MemHandleLock(h);
MemHandleUnlock(h);
length = StrLen(buffer);
place [length];
b=0;
while (inOffset<length)
{
inOffset += TxtGetNextChar(buffer, inOffset, &outChar);
if (outChar == nullChr)
{
place[b-1]=outChar;
}
}
StrCopy(h, place); //this is the problem line
fld = FrmGetObjectPtr (frm, FrmGetObjectIndex (frm, ActionPrevField));
FldSetTextHandle (fld, h);
FldReleaseFocus (fld);
}