VS01_读取csv文件
程序员文章站
2022-06-08 17:34:28
...
读取csv文件源码
.cpp
#include “pch.h”
#include
#include <stdio.h>
using namespace std;
string Trim(string& str)
{
str.erase(0, str.find_first_not_of(" \t\r\n"));
str.erase(str.find_last_not_of(" \t\r\n") + 1);
return str;
}
stTrgInfo g_stTrgInfo;
int main()
{
bool b_TrgFlag = 0;
bool b_LogicFlag = 0;
int i = 0;
int j = 0;
int iLogicNum = 0;
int iStrLen = 0;
int iTrgValue = 0;
long int liWidth = 0;
long int liLowBit = 0;
string str_Type = “”;
string str_Name = “”;
string str_Width = “”;
string str_LowBit = “”;
string str_HighBit = “”;
string str_TrgValue = “”;
FILE *fp = NULL;
char filename[40] = { 0 };
printf("Input the file name\r\n");
printf("#~ ");
gets_s(filename);
//fp = fopen(filename, "r");
ifstream fin(filename); //打开文件流操作
string line;
while (getline(fin, line)) //整行读取,换行符“\n”区分,遇到文件尾标志eof终止读取
{
//cout
下一篇: 如何调试Php?