Ken Miller wrote in message <6422@palm-dev-forum>...
>
>Thanks for all the responses I have gotten. I used
>the (void *) recommendation and it fixed the previous
>errors I was getting.
>
>I am still trying to digest the whole const char *,
>char const * discussion though :)
>
>Couple remaining errors though I was wondering if
>someone could help me with :)
>
>When using the following function, I get error
>messages for both the FntCharsInWidth and
>WinDrawChars function calls. s is declared as a const
>char * which when I look at the reference for both
>those functions is what it expects. Any ideas why it
>would be complaining?
>
>static void DrawCharsToFitWidth(const char *s,
>RectanglePtr r)
> SWord stringLength = StrLen(s);
> SWord pixelWidth = r->extent.x;
> Boolean truncate;
>
> FntCharsInWidth(s, &pixelWidth, &stringLength,
>&truncate);
> WinDrawChars(s, stringLength, r->topLeft.x,
>r->topLeft.y);
>
>: In function `DrawCharsToFitWidth':
>:721: warning: passing arg 1 of `FntCharsInWidth'
>discards `const' from pointer target type
>:722: warning: passing arg 1 of `WinDrawChars'
>discards `const' from pointer target type
I don't know if it would make a difference (it is hard to see
how it could, actually) , but the PalmOS API has it's own
even when it comes to the standard variable types.
Perhaps you should use "const Char *s" (note the capital
'C') as your parameter prototype.
>Also for the following lines I get a parse error.
>Common.h is included and I checked that UInt was in
>there. Any ideas?
>
> UInt index = dmMaxRecordIndex;
> VoidHand h = DmNewRecord(gPersonDB, &index, 1);
>
>: In function `InitializePersons':
>:758: parse error before `index'
>:760: `h' undeclared (first use this function)
>:760: (Each undeclared identifier is reported only
>once
>:760: for each function it appears in.)
>:762: `index' undeclared (first use this function)
>
>Thanks for the help in advance.
>
Do you have any code before the line
containing "UInt index = ..."?
One of the things that loosened up in C++ was
the ability to declare variables, have some code,
then declare more variables. In C however this
is still not ok. All declarations must occur at the
beginning of a code block.
--
-Richard M. Hartman
[EMAIL PROTECTED]
186,000 mi/sec: not just a good idea, it's the LAW!
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palm.com/devzone/mailinglists.html