that definately works, except for one thing that has struck me as quite odd.
i always thought that all variables made in a function get destroyed after
the function is done (pointers don't get destroyed, but dereferenced).

For some reason, the function is keeping a connection to the variable
somehow.  Take for example this peice of code:
    Char a[15] = "123456789";
    Char b[15] = "987654321";
    Char c[15] = "741852963";

    PadStringWithChar(a,15,' ');
    PadStringWithChar(b,15,' ');
    PadStringWithChar(c,15,' ');

when i put it through the debugger i found that:
a ends up being "123456789                  "
b ends up being "            "
c ends up being ""

am i doing something wrong, or do i have to somehow tell the pointer to
dereference the original char ?
i appreciate the help!



"ThuNguyet Nguyen" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> Hi there,
>
> To get the text in the field, search the archives for textfield or
SetFieldText(), GetFieldText(),
> FreeFieldText()... These functions are in almost every Palm books that I
read.
>
> After you get the string from your text field, you can pad it with this
function (no compiling and
> testing ...)
>
> // <->inString, string before and after padding
> // -> maxlen, string len after padding
> // -> ch, the character that you want to pad to the inString
> // the input inString must have enough room for at least maxlen+1
characters.
> //
> void PadStringWithChar(Char *inString, UInt16 maxlen, Char ch)
> {
>    Int16 i;
>    UInt16 len;
>
>    len = StrLen(inString);
>    for(i=len; i<maxlen; i++) {
>       inString[i] = ch;
>    }
>    if (len<maxlen) {
>       inString[maxlen] = nullChr;
>    }
> }
>
> If you want to pad the string with spaces, then you would call
> PadStringWithChar(myString, 15, ' ');
>
> Hope that helps.
>
> tnn
>
> __________________________________
> Do you Yahoo!?
> Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
> http://calendar.yahoo.com
>
>



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

Reply via email to