~ubuntu-branches/ubuntu/trusty/gsl-ref-html/trusty

« back to all changes in this revision

Viewing changes to Reading-and-writing-vectors.html

  • Committer: Bazaar Package Importer
  • Author(s): Dirk Eddelbuettel
  • Date: 2006-04-12 19:46:32 UTC
  • mfrom: (1.3.1 upstream) (3.1.1 dapper)
  • Revision ID: james.westby@ubuntu.com-20060412194632-c9lodpl075pv9si3
Tags: 1.8-1
* New upstream release 1.8
* As with previous releases, the sources were obtained from the FSF web 
  pages by means of a wget call (c.f. the debian/rules target 'upstream')

* debian/control: Standards-Version increased to 3.6.2
* debian/copyright: Updated FSF address
* debian/rules: Set DH_COMPAT=4

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<html lang="en">
 
2
<head>
 
3
<title>Reading and writing vectors - GNU Scientific Library -- Reference Manual</title>
 
4
<meta http-equiv="Content-Type" content="text/html">
 
5
<meta name="description" content="GNU Scientific Library -- Reference Manual">
 
6
<meta name="generator" content="makeinfo 4.8">
 
7
<link title="Top" rel="start" href="index.html#Top">
 
8
<link rel="up" href="Vectors.html#Vectors" title="Vectors">
 
9
<link rel="prev" href="Initializing-vector-elements.html#Initializing-vector-elements" title="Initializing vector elements">
 
10
<link rel="next" href="Vector-views.html#Vector-views" title="Vector views">
 
11
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
 
12
<!--
 
13
Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 The GSL Team.
 
14
 
 
15
Permission is granted to copy, distribute and/or modify this document
 
16
under the terms of the GNU Free Documentation License, Version 1.2 or
 
17
any later version published by the Free Software Foundation; with the
 
18
Invariant Sections being ``GNU General Public License'' and ``Free Software
 
19
Needs Free Documentation'', the Front-Cover text being ``A GNU Manual'',
 
20
and with the Back-Cover Text being (a) (see below).  A copy of the
 
21
license is included in the section entitled ``GNU Free Documentation
 
22
License''.
 
23
 
 
24
(a) The Back-Cover Text is: ``You have freedom to copy and modify this
 
25
GNU Manual, like GNU software.''-->
 
26
<meta http-equiv="Content-Style-Type" content="text/css">
 
27
<style type="text/css"><!--
 
28
  pre.display { font-family:inherit }
 
29
  pre.format  { font-family:inherit }
 
30
  pre.smalldisplay { font-family:inherit; font-size:smaller }
 
31
  pre.smallformat  { font-family:inherit; font-size:smaller }
 
32
  pre.smallexample { font-size:smaller }
 
33
  pre.smalllisp    { font-size:smaller }
 
34
  span.sc    { font-variant:small-caps }
 
35
  span.roman { font-family:serif; font-weight:normal; } 
 
36
  span.sansserif { font-family:sans-serif; font-weight:normal; } 
 
37
--></style>
 
38
</head>
 
39
<body>
 
40
<div class="node">
 
41
<p>
 
42
<a name="Reading-and-writing-vectors"></a>
 
43
Next:&nbsp;<a rel="next" accesskey="n" href="Vector-views.html#Vector-views">Vector views</a>,
 
44
Previous:&nbsp;<a rel="previous" accesskey="p" href="Initializing-vector-elements.html#Initializing-vector-elements">Initializing vector elements</a>,
 
45
Up:&nbsp;<a rel="up" accesskey="u" href="Vectors.html#Vectors">Vectors</a>
 
46
<hr>
 
47
</div>
 
48
 
 
49
<h4 class="subsection">8.3.4 Reading and writing vectors</h4>
 
50
 
 
51
<p>The library provides functions for reading and writing vectors to a file
 
52
as binary data or formatted text.
 
53
 
 
54
<div class="defun">
 
55
&mdash; Function: int <b>gsl_vector_fwrite</b> (<var>FILE * stream, const gsl_vector * v</var>)<var><a name="index-gsl_005fvector_005ffwrite-842"></a></var><br>
 
56
<blockquote><p>This function writes the elements of the vector <var>v</var> to the stream
 
57
<var>stream</var> in binary format.  The return value is 0 for success and
 
58
<code>GSL_EFAILED</code> if there was a problem writing to the file.  Since the
 
59
data is written in the native binary format it may not be portable
 
60
between different architectures. 
 
61
</p></blockquote></div>
 
62
 
 
63
<div class="defun">
 
64
&mdash; Function: int <b>gsl_vector_fread</b> (<var>FILE * stream, gsl_vector * v</var>)<var><a name="index-gsl_005fvector_005ffread-843"></a></var><br>
 
65
<blockquote><p>This function reads into the vector <var>v</var> from the open stream
 
66
<var>stream</var> in binary format.  The vector <var>v</var> must be preallocated
 
67
with the correct length since the function uses the size of <var>v</var> to
 
68
determine how many bytes to read.  The return value is 0 for success and
 
69
<code>GSL_EFAILED</code> if there was a problem reading from the file.  The
 
70
data is assumed to have been written in the native binary format on the
 
71
same architecture. 
 
72
</p></blockquote></div>
 
73
 
 
74
<div class="defun">
 
75
&mdash; Function: int <b>gsl_vector_fprintf</b> (<var>FILE * stream, const gsl_vector * v, const char * format</var>)<var><a name="index-gsl_005fvector_005ffprintf-844"></a></var><br>
 
76
<blockquote><p>This function writes the elements of the vector <var>v</var> line-by-line to
 
77
the stream <var>stream</var> using the format specifier <var>format</var>, which
 
78
should be one of the <code>%g</code>, <code>%e</code> or <code>%f</code> formats for
 
79
floating point numbers and <code>%d</code> for integers.  The function returns
 
80
0 for success and <code>GSL_EFAILED</code> if there was a problem writing to
 
81
the file. 
 
82
</p></blockquote></div>
 
83
 
 
84
<div class="defun">
 
85
&mdash; Function: int <b>gsl_vector_fscanf</b> (<var>FILE * stream, gsl_vector * v</var>)<var><a name="index-gsl_005fvector_005ffscanf-845"></a></var><br>
 
86
<blockquote><p>This function reads formatted data from the stream <var>stream</var> into the
 
87
vector <var>v</var>.  The vector <var>v</var> must be preallocated with the correct
 
88
length since the function uses the size of <var>v</var> to determine how many
 
89
numbers to read.  The function returns 0 for success and
 
90
<code>GSL_EFAILED</code> if there was a problem reading from the file. 
 
91
</p></blockquote></div>
 
92
 
 
93
   </body></html>
 
94