在C++中如何读文件中的空格
我想从文件中读取"abc def"放入字符串变量st[]中(包括中间的空格)
#include #include void main() { ifstream fin; char st[10]; fin.open("input.txt", ios::in|ios::nocreate); // 以输入方式打开文件,如果文件不存在,不会创建文件 fin.getline(st, 10, '\n'); // 10为字符串数组最大可用空间,包括作结束标记的0;'\n'为输入的结束字符 cout<
答:详情>>