-1
#include <iostream>
#include <string>
#include <fstream>
#include <cstring>
using namespace std;
int main(){
char a;
cout << "give me the filename: ";
cin >> filename;
ifstream caroll;
caroll.open(filename.c_str());
while (a=caroll.get() && !caroll.eof()){
cout << a << " ";
}
caroll.close();
}
我得到的输出中充满了奇怪的字符。他们就像填满2 0和2 1的小广场。ifstream输出上奇怪的字符
这输出看起来像是一个调试器会给。 –
输出正常,并在调试模式下预期(您没有提及 - 你应该有!)。另外,什么是所有的空白? –
我编辑,因为我不能显示这些字符。见上面 –