#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
//删除字符串中空格,制表符tab等无效字符
string Trim(string& str)
{
str.find_first_not_of(" \t\r\n");//在字符串str中从索引0开始,返回首次不匹配"\t\r\n"的位置
str.erase(0, str.find_first_not_of(" \t\r\n"));
//str.erase(str.find_last_not_of(" \t\r\n") + 1);
return str;
}
int main()
{
double x[1024];
int i = 0;
ifstream fin("hao3-1.csv"); //打开文件流操作
string line;
while (getline(fin, line)) //整行读取,换行符“\n”区分,遇到文件尾标志eof终止读取
{
// cout << "原始字符串:" << line << endl; //整行输出
istringstream sin(line); //将整行字符串line读入到字符串流istringstream中
vector<string> fields; //声明一个字符串向量
string field;
本内容试读结束,登录后可阅读更多
下载后可阅读完整内容,剩余1页未读,立即下载