RE: [ROOT] string array

From: Radovan Chytracek (Radovan.Chytracek@cern.ch)
Date: Tue Oct 30 2001 - 15:00:02 MET


Hi,

     you'd better write it as:

root [2] char* correctfil[3] = { "aa", "bb", "cc" };
root [3] cout << correctfil[0] << endl;
aa

I think it's not correct to initialize the char arrays by pointers to char
strings.
I suggest C functions strcpy(...) or strncpy(...)instead.

Radovan


> -----Original Message-----
> From: owner-roottalk@pcroot.cern.ch
> [mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Pierpaolo Righini
> Sent: Tuesday, 30 October 2001 14:44
> To: roottalk@pcroot.cern.ch
> Subject: [ROOT] string array
>
>
> Hi, it seems to me that the array of strings is not supported by CINT
> (version 5.15.10), so code like the following:
>
> char fil[3][50]={"aaaa", "bbbb", "cccc"};
> cout << fil[0] << endl;
>
> shows not reasonable results.
> Cheers.
>
>    Pierpaolo
>
>



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:05 MET