next up previous contents index
Next: Function Pointers Up: Problems Previous: Memory Management

Strings and Opaque Data

Strings are written as opaque data, i.e. in their binary representation, therefore the result depends on the machines character set. Using just the basic characters a-z, A-Z, 0-9 should be save because their representation is identical in most character sets (they could cause trouble when a 16 bit character set is used), but language specific characters will lead to unexpected result.

To create machine-independent files (apart from strings) it is necessary to write all data with the appropriate XDR functions. For opaque data pointers like the char * data pointer in class Fe2d it is impossible to determine which XDR function has to be used, therefore such data can only be written in its machine-dependent binary representation. To avoid this problem the Fe2d data is only written if its size size_of_data is a multiple of sizeof(double). In this case data is expected to point an array of doubles and the data is written using xdr_double -- if data points to some other data type the resulting data will be machine-dependent.



SFB 256 Universität Bonn and IAM Universität Freiburg

Copyright © by the Sonderforschungsbereich 256 at the Institut für Angewandte Mathematik, Universität Bonn.