Description C/C++ | n columns of a table are read into the vectors passed to VF_nread. The number of lines is specified as the number of elements of each vector, which is size.
The entries of each line should be separated by spaces (' ') or tab characters ('\t').
Each line must be terminated by a line-feed character ('\n'). The length of the lines is limited according the following rules:
- Either all lines have the same length. In this case, the length is determined automatically and might in principle be as large as 65535 characters.
- Or the maximum length is given by the number n of vectors to be read and by the data type:
It is possible to read fewer vectors than there are columns in a table. In this case, the trailing columns are neglected. If, however, you try to read more vectors than there are columns, the result is undefined and might lead to an error.
Complex versions (both cartesian and polar):
Real und imaginary (or Mag and Arg) parts may, but need not, be enclosed in braces { }. However, you must be consequent: Either all or no element may be written with braces.
Whole-number versions except VQI_nread:
By default, the numbers to be read are interpreted as decimal numbers. You may use V_setRadix to define any radix between 2 and 36. |
Example C/C++ | VF_nread( 3, 100, DataFile, X, Y, Z ); |
GCC Windows specific: | In principle, the Windows port of GCC supports the 80-bit floating point type long double. However, the I/O routines rely on the runtime libraries of Visual C++, where 80-bit reals have disappeared a long time ago. This means that VE_nread, VCE_nread, and VPE_nread work only with double precision and, more importantly, within double range. Input numbers outside double range are treated as ±DBL_MAX. |
Description Pascal/Delphi | n columns of a table are read into the vectors passed as the list VecList to VF_nread. The number of lines is specified as the number of elements of each vector, which is size.
The entries of each line should be separated by spaces (' ') or tab characters (#9). Other separators are not allowed. Each line must be terminated by a line-feed character (#13).
It is possible to read fewer vectors than there are columns in a table. In this case, the trailing columns are neglected. If, however, you try to read more vectors than there are columns, the result is undefined and might lead to an error.
Complex versions (both cartesian and polar):
Real und imaginary (or Mag and Arg) parts may (but need not) be enclosed in braces { }. However, you must be consequent: Either all or no element may be written with braces.
Whereas the C version of these functions follows the conventions of the C functions strtod, strtol, etc., the Pascal version has to follow the rules applying to the Pascal function Read. This makes the Pascal version much less flexible than the C version:
- no separation characters allowed other than ' ' and #9,
- no automatic truncation of overflowing numbers,
- no function V_setRadix |
Example Pascal/Delphi | var MyFile: Text;
X, Y1, Y2: fVector;
VList: array[0..2] of fVector;
begin
X := VF_vector( 100 );
Y1 := VF_vector( 100 );
Y2 := VF_vector( 100 );
VList[0] := X; VList[1] := Y1; VList[2] := Y2;
Assign( MyFile, 'Myfile.DAT' );
Reset( MyFile );
VF_nread( @VList, 3, 100, MyFile );
...
end; |
|