We help IT Professionals succeed at work.
Get Started

String to MemHandle

bravotango
bravotango asked
on
250 Views
Last Modified: 2013-12-27
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);
}
Comment
Watch Question
CERTIFIED EXPERT
Top Expert 2006
Commented:
This problem has been solved!
Unlock 2 Answers and 14 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE