V.._write and V.._nwrite: C/C++ only! (OptiVec vector function)">V_write, V_nwrite:, C/C++, only!">
FunctionDefinition of the format to be used by V.._write and V.._nwrite: C/C++ only!
Syntax C/C++#include <VFstd.h>
void VF_setWriteFormat( char *FormatString );
C++ VecObj#include <OptiVec.h>
void vector<T>::setWriteFormat( char *FormatString );
DescriptionThe functions of the VF_write and VF_nwrite families employ internally the ANSI C function fprintf in order to print numbers into a stream.
According to the rules described in the documentation of your C compiler's printf function, the format may be specified as fits your needs. When defining a write format, one should always be aware of the restrictions imposed by the read functions (not all formats you can write will be read correcly, see VF_read).

VF_setWriteFormat should not be used for the definition of whitespace before or after the numbers. This is the task of VF_setWriteSeparate.

For details about the formats used for each of the various data types, please refer to the following table. The last column of this table gives the maximum length of the format string.
VersionStandard FormatAlternative Examplemax. length
VF_"% 11.8e""% 8.4f"16
VD_"% 19.16le""% 16.8lf"16
VE_"% 22.19Le""% 22.19LG"16
VCF_"% 11.8e, % 11.8e""{% 8.4f, % 8.4f}"32
VCD_"% 19.16le, % 19.16le""{% 19.16lE % 19.16lE}"32
VCE_"% 22.19Le, % 22.19Le""{% 22.19Lg % 22.19Lg}"32
VPF_"% 11.8e @% 11.8e""{% 8.4f @% 8.4f}"32
VPD_"% 19.16le @% 19.16le""{% 19.16lE @% 19.16lE}"32
VPE_"% 22.19Le @% 22.19Le""{% 22.19Lg @% 22.19Lg}"32
VI_"% 10d""0x% 8x"12
VBI_"% 3hd""0x% 2hX"12
VSI_"% 5hd""0x% 4hX"12
VLI_"% 10ld""%08lXh"12
VQI_"% 20lld"16
VUQ_"%20I64u" 12

Note that byte-sized integers are extended to 16-bit before being printed, so that the format specifier has to be for 16-bit numbers.

Error handlingFormat strings longer than the maximum length specified in the above table lead to a program abort with the error message "Invalid Parameter(s)".
The contents of the format string is not checked. So you have to be very careful to specify a format which is valid for the respective data type.
Return valuenone
See alsoVF_setWriteSeparate,   VF_write,   VF_nwrite,   VF_read,   VF_nread

VectorLib Table of Contents  OptiVec home