--- [EMAIL PROTECTED] wrote:
> This is my code.
> 
>   UInt8 *percentP;
>                            SysBatteryKind *kindP;
>                              char *PercentStr;
>                              char *Percents;
>                             UInt16 Kind;
>                             Kind=SysBatteryInfoV20
> (false,NULL,NULL,NULL,kindP,false);
>                              PercentStr=StrIToA
> (Percents, Kind->kindP);
>                             fld=(FieldPtr)
> GetObjectPtr(MainOutputField);
>                            
> FldSetTextPtr(fld,Kind.kindP);
>                            
>                             FldDrawField(fld);
> 
> My error is here though
> PercentStr=StrIToA (Percents, Kind->kindP);
> 
> It says Kind isn't an array.
> 

Actually, I think it probably says "Error:
pointer/array required".  You probably also got
"Error: undefined identifier 'fld'" elsewhere.

This is a C/C++ question, not a Palm development
question.  StrIToA is defined like this:

  Char *StrIToA (Char *s, Int32 i)

So you have to pass it two things:
1. A pointer to a string (Char *s), or an array of
characters (Char s[size]), and
2. An Int32.

In your code, you passed in Kind->kindP.  You declared
Kind as an UInt16, not as a pointer, and it isn't
pointing to any structure that has a kindP member.

There are too many more errors to bother listing them
all.  Basically, what you need to do is to get a good
tutorial on the C programming language.

If you want to solve this one small problem, use this
code (but you still need to get a good tutorial on
C!):

// a global var, so you can use it as a field pointer:
// (it has to exist as long as the form that contains
// the field exists if you want to use FldSetTextPtr.)
static Char Percents[50];

// local vars
SysBatteryKind kind;
UInt16 volts;
FieldPtr fld;

volts = SysBatteryInfoV20( false, NULL, NULL, NULL,
&kind, NULL );
StrIToA( Percents, kind );
...


__________________________________________________
Do You Yahoo!?
NEW from Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
http://geocities.yahoo.com/ps/info1

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