In a message dated 10/23/00 10:15:50 AM Eastern Daylight Time, 
[EMAIL PROTECTED] writes:

<< Hello All-
 
   I'm trying to access functions in the String manager API and get a major
 failure at simulation time within POSE.  I'm running Code Warrior R6 with
 version 3.0a6 of POSE. Here is my simplified code segment:
 
 #include <Pilot.h>
 #include <StringMgr.h>
 
 static Boolean TimerFormHandleEvent(EventPtr event)
 {
    CharPtr strptr, dbgptr;
    // other variable declarations here
 
 ...
 
    strptr = "00:00.0";
    dbgptr = "12:34.5";
 
    // other case statement code here for handling the various events on the
 form...
 switch(event->data.ctlSelect.controlID) {
    case TimerFormRecalcButton:
       StrCopy(dbgptr, srcptr);
       break;
 }
 
 When I am running and get to the string copy line, I get a failure with a
 dialog window (with no error description thank you very much) and the Close
 button.  The Error dialog is just an empty window with a couple of ASCII
 graphic (garbage) characters in it.
 
 I've got the prototype properly included (right?).  Is there something else
 I need to do from within CW to access functions of the string manager?
 
 Regards
 John >>



I'm a little suspicious of your StrCopy() function call.  I would imagine 
that you shouldn't be using StrCopy() when it is pointing to the constant 
string "12:34.5".  I tried it on my compiler (BorlandC++/Win98), and it 
worked fine, but I don't know why.  I would have figured that it would have 
given me an exception for trying to write into memory that only has read 
access.  Just for kicks, try something like this instead:

Char    dbgptr[10];
 static Boolean TimerFormHandleEvent(EventPtr event)
 {
    CharPtr strptr;

    // other variable declarations here
 
 ...
 
    strptr = "00:00.0";


    StrNCpy(dbgptr, "12:34.5", sizeof(dbgptr));
 
    // other case statement code here for handling the various events on the
 form...
 switch(event->data.ctlSelect.controlID) {
    case TimerFormRecalcButton:
       StrNCopy(dbgptr, srcptr, sizeof(dbgptr));
       break;
 }

-Pete

PS: I've made 'dbgptr' a global variable instead of a function variable since 
you probably need its lifetime to last as long as the form object that you 
are using it with.

PPS: In your StrCopy() call, your second string parameter was listed as 
'srcptr' instead of 'strptr'.  Was that a typo?

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to