Next: Example programs for blocks, Previous: Block allocation, Up: Blocks [Index]
The library provides functions for reading and writing blocks to a file as binary data or formatted text.
This function writes the elements of the block b to the stream
stream in binary format. The return value is 0 for success and
GSL_EFAILED
if 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.
This function reads into the block b from the open stream
stream in binary format. The block b must be preallocated
with the correct length since the function uses the size of b to
determine how many bytes to read. The return value is 0 for success and
GSL_EFAILED
if 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.
This function writes the elements of the block b line-by-line to
the stream stream using the format specifier format, which
should be one of the %g
, %e
or %f
formats for
floating point numbers and %d
for integers. The function returns
0 for success and GSL_EFAILED
if there was a problem writing to
the file.
This function reads formatted data from the stream stream into the
block b. The block b must be preallocated with the correct
length since the function uses the size of b to determine how many
numbers to read. The function returns 0 for success and
GSL_EFAILED
if there was a problem reading from the file.
Next: Example programs for blocks, Previous: Block allocation, Up: Blocks [Index]