[prev in list] [next in list] [prev in thread] [next in thread] 

List:       aix-l
Subject:    Re: Off topic  : beginners C question
From:       "McKown, John" <JMckown () HEALTHAXIS ! COM>
Date:       2000-05-30 17:21:23
[Download RAW message or body]


> -----Original Message-----
> From: Ferenc Gyurcsan [SMTP:fgyurcsa@AVAILANT.COM]
> Sent: Tuesday, May 30, 2000 11:40 AM
> To:   AIX-L@pucc.Princeton.EDU
> Subject:      Re: Off topic  : beginners C question
>
> >long* list[2]
>
> >and I want to convert each element to a pointer to char field.
> (char *)(list[1]) ?
>
> Ferenc
>
        Uh, I think what he really meant was "I want to take each element in
long* list[2] and create another array each element of which is a pointer to
a char array whose contents is the printable equivalent of  the original
'long' variable".  However, in general, I would determine the amount of
storage needed for the array and each of the character arrays. Then I'd
malloc() or new() that amount of storage. I'd then use sprintf() or
snprintf() (not sure if snprintf() is in AIX) to create the elements of the
result array. It would be easier to just malloc() a specific amount of
memory or just use a plain variable.

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic