【发布时间】:2016-02-06 15:43:16
【问题描述】:
我基本上有一个分号分隔的文本文件,在该文件中有一些命令,如“A”、“P”、“R”、“S”,以及根据这些命令处理的输入,如名称“Ali Aksu , Mithat Köse”,就像交易“处理,撤回”。我有一个程序可以在控制台中处理这些输入而没有任何问题(用户提供输入)。但我需要让它从分号分隔的文件中获取输入。这是一个阅读测试:
这是一个示例输入文件:
A;Ali;Aksu;N;2;deposit;withdraw
P
A;Mithat;Köse;P;3;deposit;credit;withdraw
这是控制台的输出:
A/Ali/Aksu/N/2/deposit/withdraw
P
A/Mithat/Köse/P/3/deposit/credit/withdraw
/
1.问题:无法读取“ö”等特殊字符 2.问题:为什么要以这个奇怪的“”字符开头?
#include <iostream>
#include <fstream>
using namespace std;
int main(){
setlocale(LC_ALL, "Turkish");
fstream myfile;
char *string;
string = new char[50];
myfile.open("input_file.txt",ios::in);
while(!myfile.eof()){
myfile.getline(string, 49, ';');
cout << string << "/";
}
myfile.close();
cout << endl;
system("pause");
return 0;
}
【问题讨论】:
-
Google for Utf-8 / Unicode 和 CSV
标签: c++