Problems using alertc()

Discuss PocketC for Palm OS (including Desktop Edition)

Postby Vigon on Fri Jun 10, 2005 7:32 am

I tried to use alertc() in diferent programs,
but the behavior is very strange because the string message field shows corrupted messages depending the size or format of the message.
Example code:
Code: Select all
//Testing alertc()with PDE version 7.0.0

main()   {
string TestString="";
graph_on() ;

   if(alertc("Modbus Commands" ,
      "Sent: " + TestString +
      "\nTime-Out: " + TestString +
      "\nCRC: " + TestString ,
      "OK:Clear", 0))TestString="";
   TestString= TestString +"0"; //increasing the size of TestString.


apreciate any help :)
Posts: 43
Joined: Wed Apr 17, 2002 2:26 pm
Location: Venezuela

Postby dewey on Tue Jun 14, 2005 3:33 am

This is a PocketC bug where it is releasing the string's memory before drawing the custom alert. Sometimes this memory is being overwritten before the alert is drawn.

To workaround this until a fix is released store the text of the alert in a variable - this will cause the string remain undeleted while the alert is active.

string text;
text = "Sent: " + TestString....

alertc("Modbus Commands", text, "OK:Clear", 0);
Site Admin
Posts: 749
Joined: Sun Oct 21, 2007 5:12 am

Return to PocketC for Palm OS

Who is online

Users browsing this forum: No registered users and 2 guests