📄 example.cc
字号:
// file: $isip/doc/examples/class/dstr/dstr_example_02/example.cc// version: $Id: example.cc,v 1.3 2000/12/17 18:15:41 duncan Exp $//// isip include files//#include <String.h>#include <Vector.h>// main program starts here:// this example demonstrates reading and writing data structures to a// text sof file. the output file will not be deleted so that the user// may examine the output upon exiting.//int main () { // create a string filename that we will write to // String file(L"dstr_example_02.sof"); // create a Vector of Strings: // the vector has length 3. note that we are using the indexing operator() // to directly access the objects internal to the vector // String string_0(L"for more information"); String string_1(L"please see"); String string_2(L"http://www.isip.msstate.edu/"); Vector<String> vec_write(3); vec_write(0).assign(string_0); vec_write(1).assign(string_1); vec_write(2).assign(string_2); // write the Vector to a text Sof file // Sof text_file; text_file.open(file, File::WRITE_ONLY, File::TEXT); vec_write.write(text_file, 0); text_file.close(); // read the file back in: // the read vector should be identical to the vector we wrote // text_file.open(file); Vector<String> vec_read; vec_read.read(text_file, 0); text_file.close(); // print the two vectors // vec_write.debug(L"vector we wrote"); Console::put(L""); vec_read.debug(L"vector we read"); // exit gracefully // Integral::exit();}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -