Changeset 1064 for library/doc/tutorial/src/write_it_file.cpp
- Timestamp:
- 06/09/10 14:00:40 (16 years ago)
- Files:
-
- 1 modified
-
library/doc/tutorial/src/write_it_file.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
library/doc/tutorial/src/write_it_file.cpp
r477 r1064 4 4 5 5 int main() { 6 // Declare the it_file class7 it_file ff;6 // Declare the it_file class 7 it_file ff; 8 8 9 // Open a file with the name "it_file_test.it"10 ff.open ( "it_file_test.it" );9 // Open a file with the name "it_file_test.it" 10 ff.open ( "it_file_test.it" ); 11 11 12 // Create some data to put into the file13 vec a = linspace ( 1, 20, 20 );12 // Create some data to put into the file 13 vec a = linspace ( 1, 20, 20 ); 14 14 15 // Put the variable a into the file. The Name("a") tells the file class16 // that the next variable shall be named "a".17 ff << Name ( "a" ) << a;15 // Put the variable a into the file. The Name("a") tells the file class 16 // that the next variable shall be named "a". 17 ff << Name ( "a" ) << a; 18 18 19 // Force the file to be written to disc. This is useful when performing20 // iterations and ensures that the information is not stored in any cache21 // memory. In this simple example it is not necessary to flush the file.22 ff.flush();19 // Force the file to be written to disc. This is useful when performing 20 // iterations and ensures that the information is not stored in any cache 21 // memory. In this simple example it is not necessary to flush the file. 22 ff.flush(); 23 23 24 // Close the file25 ff.close();24 // Close the file 25 ff.close(); 26 26 27 // Exit program28 return 0;27 // Exit program 28 return 0; 29 29 }
