头文件
#include <iostream>
#include <string>
#include <fstream>
#include <sstream>
using namespace std;
filebuf fileHandle;
if(fileHandle.open(fileName, ios::in) == NULL)
{
return false;
}
string strOneLine;
istream is(&fileHandle);
std::getline(is,strOneLine, '\n');
while(std::getline(is, strOneLine, '\n'))
{
stringstream ss(strOneLine);
string strSeqNo,strCrossName,strCrossNo,strLongtitude,strLattitude;
ss>>strSeqNo>>strCrossName>>strCrossNo>>strLongtitude>>strLattitude;
RoadCrossInfo srcinfo;
strcpy(srcinfo.szSeqNo, strSeqNo.c_str());
strcpy(srcinfo.szCrossName, strCrossName.c_str());
strcpy(srcinfo.szCrossNo, strCrossNo.c_str());
strcpy(srcinfo.szLongitude, strLongtitude.c_str());
strcpy(srcinfo.szLatitude, strLattitude.c_str());
}
fileHandle.close();