| GNU Scientific Library Reference Manual - Third Edition (v1.12) by M. Galassi, J. Davies, J. Theiler, B. Gough, G. Jungman, P. Alken, M. Booth, F. Rossi Paperback (6"x9"), 592 pages, 60 figures ISBN 0954612078 RRP £24.95 ($39.95) |
8.3.4 Reading and writing vectors
The library provides functions for reading and writing vectors to a file as binary data or formatted text.
- Function: int gsl_vector_fwrite (FILE * stream, const gsl_vector * v)
- This function writes the elements of the vector v to the stream
stream in binary format. The return value is 0 for success and
GSL_EFAILEDif there was a problem writing to the file. Since the data is written in the native binary format it may not be portable between different architectures.
- Function: int gsl_vector_fread (FILE * stream, gsl_vector * v)
- This function reads into the vector v from the open stream
stream in binary format. The vector v must be preallocated
with the correct length since the function uses the size of v to
determine how many bytes to read. The return value is 0 for success and
GSL_EFAILEDif there was a problem reading from the file. The data is assumed to have been written in the native binary format on the same architecture.
- Function: int gsl_vector_fprintf (FILE * stream, const gsl_vector * v, const char * format)
- This function writes the elements of the vector v line-by-line to
the stream stream using the format specifier format, which
should be one of the
%g,%eor%fformats for floating point numbers and%dfor integers. The function returns 0 for success andGSL_EFAILEDif there was a problem writing to the file.
- Function: int gsl_vector_fscanf (FILE * stream, gsl_vector * v)
- This function reads formatted data from the stream stream into the
vector v. The vector v must be preallocated with the correct
length since the function uses the size of v to determine how many
numbers to read. The function returns 0 for success and
GSL_EFAILEDif there was a problem reading from the file.
| ISBN 0954612078 | GNU Scientific Library Reference Manual - Third Edition (v1.12) | See the print edition |