[Nexus-developers] NXgetinfo() problem

Akeroyd, FA (Freddie) freddie.akeroyd at stfc.ac.uk
Tue Feb 24 09:34:55 GMT 2009


I'm posting this following a conversation with Paul Kienzle - he had
initially executed the following via python:

NXmakedata(10 element NX_CHAR) 
NXopendata()
NXgetinfo()

NXgetinfo returned 0 for the array size when the data type was NX_CHAR,
but size 10 for any other data type.

The problem is related to the default stripping of spaces from strings
by the NeXus API - passing NOSTRIP to NXopen() results in NXgetinfo
returning 10 for the string size. 

This raises the general question: how can you determine the maximum size
you can write to a NX_CHAR array? The NeXus file may not have been
opened NOSTRIP by a user of the python API, so to use the NOSTRIP
workaround would mean python opening the file with NOSTRIP and then
emulating the stripping behaviour. The documentation for NXgetinfo()
does not say whether, for a string, it should return the current or
declared size - is a new API function the only way? If NXgetinfo() has
only been used to determine how much memory to allocate for a string
then changing it would not break anything; however if code relies on it
effectively doing a strlen() then this may break.

Freddie

-- 

Scanned by iCritical.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.nexusformat.org/pipermail/nexus-developers/attachments/20090224/c0f1d13b/attachment.html 


More information about the NeXus-developers mailing list