摘要: 可以用strtok1 char * strtok ( char * str, const char * delimiters ); // 函数原型 1 /* strtok example */ 2 #include <stdio.h> 3 #include <string.h> 4 5 int main () 6 { 7 char str[] ="- This, a sample string."; 8 char * pch; 9 printf ("Splitting string \"%s\" into tokens: 阅读全文
posted @ 2013-01-05 21:21 行者无疆!! 阅读(513) 评论(0) 推荐(0) 编辑
摘要: 包含头文件fstream,文件已经存在。 1 #include <iostream> 2 #include <fstream> 3 #include <string> 4 using namespace std; 5 6 int main() { 7 string str; 8 // size_t filesize; 9 10 ifstream file("test.txt", ios::in | ios::ate);11 // filesize = file.tellg();12 13 // str.reserve(filesize); 阅读全文
posted @ 2013-01-05 15:39 行者无疆!! 阅读(374) 评论(0) 推荐(0) 编辑