Revision 278, 0.7 kB
(checked in by smidl, 16 years ago)
|
props
|
-
Property svn:eol-style set to
native
|
Line | |
---|
1 | #include <itpp/itcomm.h> |
---|
2 | |
---|
3 | using namespace itpp; |
---|
4 | |
---|
5 | int main() |
---|
6 | { |
---|
7 | // Declare the it_file class |
---|
8 | it_file ff; |
---|
9 | |
---|
10 | // Open a file with the name "it_file_test.it" |
---|
11 | ff.open("it_file_test.it"); |
---|
12 | |
---|
13 | // Create some data to put into the file |
---|
14 | vec a = linspace(1, 20, 20); |
---|
15 | |
---|
16 | // Put the variable a into the file. The Name("a") tells the file class |
---|
17 | // that the next variable shall be named "a". |
---|
18 | ff << Name("a") << a; |
---|
19 | |
---|
20 | // Force the file to be written to disc. This is useful when performing |
---|
21 | // iterations and ensures that the information is not stored in any cache |
---|
22 | // memory. In this simple example it is not necessary to flush the file. |
---|
23 | ff.flush(); |
---|
24 | |
---|
25 | // Close the file |
---|
26 | ff.close(); |
---|
27 | |
---|
28 | // Exit program |
---|
29 | return 0; |
---|
30 | } |
---|