"Thomas Ward" <[EMAIL PROTECTED]> wrote:

> I have the following variable in my code:
> 
> char             display_string[41];
> 
> When I try to execute the following statement:
> 
> StrPrintF(display_string, "%s:%c:%s", "str1", 'R', "str");
> 
> I get an error: "my application (version) has just written directly to
> memory manager data structures."
> 
> The problem seems to have something to do with the 'R' character I am 
trying
> to substitute, because:
> 
> StrPrintF(display_string, "%s:%s:%s", "str1", "R", "str2");
> 
> works correctly. Interestingly, if I do this:
> 
> char    c = 'R';
> StrPrintF(display_string, "%s:%c:%s", "str1", c, "str2");
> 
> it works fine.

When the compiler sees the literal 'R', it creates an int having the
value 82. You've told StrPrintF to expect a char at that place in the
argument list. That's why you don't get the error if you use
char    c = 'R';

--
Roger Chaplin
<[EMAIL PROTECTED]>

-- 
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