gslcpp
Modern-C++ Wrapper for GSL
fscanf.hpp
Go to the documentation of this file.
1 /// \file include/gslcpp/wrap/fscanf.hpp
2 /// \copyright 2022 Thomas E. Vaughan, all rights reserved.
3 /// \brief Definition of gsl::w_fscanf().
4 
5 #pragma once
6 #include "container.hpp" // w_vector
7 
8 namespace gsl {
9 
10 
11 /// Read formatted data from stream `f` into vector `v`.
12 ///
13 /// Vector `v` must have correct size before call to `%w_fscanf()` because
14 /// `%w_fscanf()` uses size of `v` to determine how many numbers to read.
15 ///
16 /// https://www.gnu.org/software/gsl/doc/html/vectors.html#c.gsl_vector_fscanf
17 ///
18 /// @param f Pointer to file-stream.
19 /// @param v Pointer to vector that will be initialized from stream.
20 /// @return 0 on success or GSL_EFAILED on problem reading from stream.
21 inline int w_fscanf(FILE *f, w_vector<double> *v) {
22  return gsl_vector_fscanf(f, v);
23 }
24 
25 
26 /// Read formatted data from stream `f` into vector `v`.
27 ///
28 /// Vector `v` must have correct size before call to `%w_fscanf()` because
29 /// `%w_fscanf()` uses size of `v` to determine how many numbers to read.
30 ///
31 /// https://www.gnu.org/software/gsl/doc/html/vectors.html#c.gsl_vector_fscanf
32 ///
33 /// @param f Pointer to file-stream.
34 /// @param v Pointer to vector that will be initialized from stream.
35 /// @return 0 on success or GSL_EFAILED on problem reading from stream.
36 inline int w_fscanf(FILE *f, w_vector<float> *v) {
37  return gsl_vector_float_fscanf(f, v);
38 }
39 
40 
41 /// Read formatted data from stream `f` into vector `v`.
42 ///
43 /// Vector `v` must have correct size before call to `%w_fscanf()` because
44 /// `%w_fscanf()` uses size of `v` to determine how many numbers to read.
45 ///
46 /// https://www.gnu.org/software/gsl/doc/html/vectors.html#c.gsl_vector_fscanf
47 ///
48 /// @param f Pointer to file-stream.
49 /// @param v Pointer to vector that will be initialized from stream.
50 /// @return 0 on success or GSL_EFAILED on problem reading from stream.
51 inline int w_fscanf(FILE *f, w_vector<long double> *v) {
52  return gsl_vector_long_double_fscanf(f, v);
53 }
54 
55 
56 /// Read formatted data from stream `f` into vector `v`.
57 ///
58 /// Vector `v` must have correct size before call to `%w_fscanf()` because
59 /// `%w_fscanf()` uses size of `v` to determine how many numbers to read.
60 ///
61 /// https://www.gnu.org/software/gsl/doc/html/vectors.html#c.gsl_vector_fscanf
62 ///
63 /// @param f Pointer to file-stream.
64 /// @param v Pointer to vector that will be initialized from stream.
65 /// @return 0 on success or GSL_EFAILED on problem reading from stream.
66 inline int w_fscanf(FILE *f, w_vector<int> *v) {
67  return gsl_vector_int_fscanf(f, v);
68 }
69 
70 
71 /// Read formatted data from stream `f` into vector `v`.
72 ///
73 /// Vector `v` must have correct size before call to `%w_fscanf()` because
74 /// `%w_fscanf()` uses size of `v` to determine how many numbers to read.
75 ///
76 /// https://www.gnu.org/software/gsl/doc/html/vectors.html#c.gsl_vector_fscanf
77 ///
78 /// @param f Pointer to file-stream.
79 /// @param v Pointer to vector that will be initialized from stream.
80 /// @return 0 on success or GSL_EFAILED on problem reading from stream.
81 inline int w_fscanf(FILE *f, w_vector<unsigned> *v) {
82  return gsl_vector_uint_fscanf(f, v);
83 }
84 
85 
86 /// Read formatted data from stream `f` into vector `v`.
87 ///
88 /// Vector `v` must have correct size before call to `%w_fscanf()` because
89 /// `%w_fscanf()` uses size of `v` to determine how many numbers to read.
90 ///
91 /// https://www.gnu.org/software/gsl/doc/html/vectors.html#c.gsl_vector_fscanf
92 ///
93 /// @param f Pointer to file-stream.
94 /// @param v Pointer to vector that will be initialized from stream.
95 /// @return 0 on success or GSL_EFAILED on problem reading from stream.
96 inline int w_fscanf(FILE *f, w_vector<long> *v) {
97  return gsl_vector_long_fscanf(f, v);
98 }
99 
100 
101 /// Read formatted data from stream `f` into vector `v`.
102 ///
103 /// Vector `v` must have correct size before call to `%w_fscanf()` because
104 /// `%w_fscanf()` uses size of `v` to determine how many numbers to read.
105 ///
106 /// https://www.gnu.org/software/gsl/doc/html/vectors.html#c.gsl_vector_fscanf
107 ///
108 /// @param f Pointer to file-stream.
109 /// @param v Pointer to vector that will be initialized from stream.
110 /// @return 0 on success or GSL_EFAILED on problem reading from stream.
111 inline int w_fscanf(FILE *f, w_vector<unsigned long> *v) {
112  return gsl_vector_ulong_fscanf(f, v);
113 }
114 
115 
116 /// Read formatted data from stream `f` into vector `v`.
117 ///
118 /// Vector `v` must have correct size before call to `%w_fscanf()` because
119 /// `%w_fscanf()` uses size of `v` to determine how many numbers to read.
120 ///
121 /// https://www.gnu.org/software/gsl/doc/html/vectors.html#c.gsl_vector_fscanf
122 ///
123 /// @param f Pointer to file-stream.
124 /// @param v Pointer to vector that will be initialized from stream.
125 /// @return 0 on success or GSL_EFAILED on problem reading from stream.
126 inline int w_fscanf(FILE *f, w_vector<short> *v) {
127  return gsl_vector_short_fscanf(f, v);
128 }
129 
130 
131 /// Read formatted data from stream `f` into vector `v`.
132 ///
133 /// Vector `v` must have correct size before call to `%w_fscanf()` because
134 /// `%w_fscanf()` uses size of `v` to determine how many numbers to read.
135 ///
136 /// https://www.gnu.org/software/gsl/doc/html/vectors.html#c.gsl_vector_fscanf
137 ///
138 /// @param f Pointer to file-stream.
139 /// @param v Pointer to vector that will be initialized from stream.
140 /// @return 0 on success or GSL_EFAILED on problem reading from stream.
141 inline int w_fscanf(FILE *f, w_vector<unsigned short> *v) {
142  return gsl_vector_ushort_fscanf(f, v);
143 }
144 
145 
146 /// Read formatted data from stream `f` into vector `v`.
147 ///
148 /// Vector `v` must have correct size before call to `%w_fscanf()` because
149 /// `%w_fscanf()` uses size of `v` to determine how many numbers to read.
150 ///
151 /// https://www.gnu.org/software/gsl/doc/html/vectors.html#c.gsl_vector_fscanf
152 ///
153 /// @param f Pointer to file-stream.
154 /// @param v Pointer to vector that will be initialized from stream.
155 /// @return 0 on success or GSL_EFAILED on problem reading from stream.
156 inline int w_fscanf(FILE *f, w_vector<char> *v) {
157  return gsl_vector_char_fscanf(f, v);
158 }
159 
160 
161 /// Read formatted data from stream `f` into vector `v`.
162 ///
163 /// Vector `v` must have correct size before call to `%w_fscanf()` because
164 /// `%w_fscanf()` uses size of `v` to determine how many numbers to read.
165 ///
166 /// https://www.gnu.org/software/gsl/doc/html/vectors.html#c.gsl_vector_fscanf
167 ///
168 /// @param f Pointer to file-stream.
169 /// @param v Pointer to vector that will be initialized from stream.
170 /// @return 0 on success or GSL_EFAILED on problem reading from stream.
171 inline int w_fscanf(FILE *f, w_vector<unsigned char> *v) {
172  return gsl_vector_uchar_fscanf(f, v);
173 }
174 
175 
176 /// Read formatted data from stream `f` into vector `v`.
177 ///
178 /// Vector `v` must have correct size before call to `%w_fscanf()` because
179 /// `%w_fscanf()` uses size of `v` to determine how many numbers to read.
180 ///
181 /// https://www.gnu.org/software/gsl/doc/html/vectors.html#c.gsl_vector_fscanf
182 ///
183 /// @param f Pointer to file-stream.
184 /// @param v Pointer to vector that will be initialized from stream.
185 /// @return 0 on success or GSL_EFAILED on problem reading from stream.
186 inline int w_fscanf(FILE *f, w_vector<complex<double>> *v) {
187  return gsl_vector_complex_fscanf(f, v);
188 }
189 
190 
191 /// Read formatted data from stream `f` into vector `v`.
192 ///
193 /// Vector `v` must have correct size before call to `%w_fscanf()` because
194 /// `%w_fscanf()` uses size of `v` to determine how many numbers to read.
195 ///
196 /// https://www.gnu.org/software/gsl/doc/html/vectors.html#c.gsl_vector_fscanf
197 ///
198 /// @param f Pointer to file-stream.
199 /// @param v Pointer to vector that will be initialized from stream.
200 /// @return 0 on success or GSL_EFAILED on problem reading from stream.
201 inline int w_fscanf(FILE *f, w_vector<complex<float>> *v) {
202  return gsl_vector_complex_float_fscanf(f, v);
203 }
204 
205 
206 /// Read formatted data from stream `f` into vector `v`.
207 ///
208 /// Vector `v` must have correct size before call to `%w_fscanf()` because
209 /// `%w_fscanf()` uses size of `v` to determine how many numbers to read.
210 ///
211 /// https://www.gnu.org/software/gsl/doc/html/vectors.html#c.gsl_vector_fscanf
212 ///
213 /// @param f Pointer to file-stream.
214 /// @param v Pointer to vector that will be initialized from stream.
215 /// @return 0 on success or GSL_EFAILED on problem reading from stream.
216 inline int w_fscanf(FILE *f, w_vector<complex<long double>> *v) {
217  return gsl_vector_complex_long_double_fscanf(f, v);
218 }
219 
220 
221 } // namespace gsl
222 
223 // EOF
gsl::w_fscanf
int w_fscanf(FILE *f, w_vector< complex< float >> *v)
Read formatted data from stream f into vector v.
Definition: fscanf.hpp:201
gsl::w_fscanf
int w_fscanf(FILE *f, w_vector< long double > *v)
Read formatted data from stream f into vector v.
Definition: fscanf.hpp:51
gsl::w_fscanf
int w_fscanf(FILE *f, w_vector< short > *v)
Read formatted data from stream f into vector v.
Definition: fscanf.hpp:126
gsl::w_fscanf
int w_fscanf(FILE *f, w_vector< unsigned char > *v)
Read formatted data from stream f into vector v.
Definition: fscanf.hpp:171
gsl::w_fscanf
int w_fscanf(FILE *f, w_vector< complex< double >> *v)
Read formatted data from stream f into vector v.
Definition: fscanf.hpp:186
gsl::w_fscanf
int w_fscanf(FILE *f, w_vector< float > *v)
Read formatted data from stream f into vector v.
Definition: fscanf.hpp:36
gsl::w_fscanf
int w_fscanf(FILE *f, w_vector< unsigned > *v)
Read formatted data from stream f into vector v.
Definition: fscanf.hpp:81
gsl::w_fscanf
int w_fscanf(FILE *f, w_vector< unsigned long > *v)
Read formatted data from stream f into vector v.
Definition: fscanf.hpp:111
gsl::w_fscanf
int w_fscanf(FILE *f, w_vector< int > *v)
Read formatted data from stream f into vector v.
Definition: fscanf.hpp:66
gsl::w_fscanf
int w_fscanf(FILE *f, w_vector< char > *v)
Read formatted data from stream f into vector v.
Definition: fscanf.hpp:156
gsl::w_fscanf
int w_fscanf(FILE *f, w_vector< unsigned short > *v)
Read formatted data from stream f into vector v.
Definition: fscanf.hpp:141
gsl::w_fscanf
int w_fscanf(FILE *f, w_vector< long > *v)
Read formatted data from stream f into vector v.
Definition: fscanf.hpp:96
gsl::w_fscanf
int w_fscanf(FILE *f, w_vector< double > *v)
Read formatted data from stream f into vector v.
Definition: fscanf.hpp:21
gsl::w_fscanf
int w_fscanf(FILE *f, w_vector< complex< long double >> *v)
Read formatted data from stream f into vector v.
Definition: fscanf.hpp:216
gsl
Namespace for C++-interface to GSL.
Definition: v-iface.hpp:51