wlav / cppyy

Other
391 stars 40 forks source link

2d char array only returns the first element #120

Closed xuyumeng closed 1 year ago

xuyumeng commented 1 year ago

Hi, I was trying to access a c++ variable defined as

char str_array[3][8] = {"A1", "B1", "C1"};

but the cppyy only returns the first element A1

The problem can be reproduced by the following

cppyy.cppdef('char str_array[3][8] = {"A1", "B1", "C1"};')
type(cppyy.gbl.str_array)
# returns: str
cppyy.gbl.str_array
# returns: 'A1'

How can I access the whole array?

wlav commented 1 year ago

What version of cppyy is this? Current release shows type(cppyy.gbl.str_array) to be a <class 'cppyy.LowLevelView'> not str?

xuyumeng commented 1 year ago

I'm using pyROOT. The cppyy by default is 1.6.2. I will ask the developer of pyROOT if it is possible to upgrade cppyy.

Thanks!

wlav commented 1 year ago

Yes, the ROOT folks use an ancient fork of cppyy and that's out of my hands. Good luck!