Functionreads a vector in ASCII format from a stream
Syntax C/C++#include <VFstd.h>
void VF_read( fVector X, ui size, FILE *stream );
C++ VecObj#include <OptiVec.h>
void vector<T>::read( FILE *stream );
Pascal/Delphiuses VFstd;
procedure VF_read( X:fVector; size:UIntSize; var Stream:Text );
Descriptionsize elements are read in ASCII format (up to 80 characters) from stream and stored in X. Normally, this function will be used to import vectors from a program which cannot store numbers in machine format. It can also be used to retrieve vectors previously stored by VF_write. For storing and retrieving intermediate results, however, the function pair VF_store / VF_recall is to be preferred over VF_write / VF_read (see VF_write).

Complex versions:
Real und imaginary parts (cartesian complex) or the Mag and Arg parts (polar complex) may, but need not, be enclosed in braces { } or brackets ( ). However, you must be consequent: Either all or no element may be written with braces or brackets.
A komma may (but need not) separate the two parts. The imaginary part (cartesian) or the Arg part (polar) must always be explicitly specified, even if it is zero.
Examples for legal formats are:
0.3 0.5    (neither braces nor separating komma)
0.3, 0.5    (no braces; separating komma)
{0.3 0.5}    (braces; no separating komma)
(0.3, 0.5)    (brackets and separating komma)

C/C++ specific:The entries to be read must be separated by whitespace (' ', '\n', or '\t'). Additionally, one (!) "non-whitespace" character is tolerated after each entry, if it follows directly after the last digit. After it, there must be one or more whitespace characters.

Whole-number versions except VQI_read:
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.

Pascal/Delphi specific:The entries to be read must be separated by whitespace (' ', #13, or #9).

Whereas the C/C++ version of these functions follows the conventions of the C functions strtod,   strtol, etc., the Pascal/Delphi version has to follow the rules applying to the Pascal/Delphi function Read. This makes the Pascal/Delphi 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

Error handlingC/C++:
Real, complex and quad versions:
Overflowing numbers are silently truncated to ±HUGE_VAL.
Whole-number versions except VQI_read:
As long as the numbers can be represented as long or unsigned long, overflowing bits are ignored in the 16-bit versions. Numbers beyond the long range yield -1 (signed types) or +HUGE_VAL (unsigned types).
Overflowing numbers or numbers otherwise not conforming to the format requirements lead to an I/O error.
Return valuenone
See alsoVF_nread,   VF_write,   VF_store,   VF_recall,   strtod,   strtol

VectorLib Table of Contents  OptiVec home