#define READBUFFSIZE 8192
AIX线程堆栈大小为98304字节,所以线程里一次读取的字节数为8192*5.避免线程堆栈太小
int iFd = open(sSouFile.c_str(),O_RDONLY);
if(iFd == -1){
cout<<"open file:"<
return;
}
int pos,pos2;
string sLastData,sOneData;
while(read(iFd,buf,READBUFFSIZE*5)>0){
if(sLastData.size()>0)
sOneData = sLastData + string(buf);
else
sOneData = buf;
memset(buf,0,sizeof(buf));
pos = pos2 = 0 ;
sLastData = "";
while((pos=sOneData.find("\n", pos))!= string::npos){
++i;
if(i<=6){
pos2 = ++pos;
continue;//计费去掉前6行详单头信息
}
//一条纪录
cout<<"jf rec="<
pos2 = ++pos;
}
int recsize = sOneData.size();
if(pos2 sLastData = sOneData.substr(pos2,recsize-pos2);
}
close(iFd);
阅读(1507) | 评论(0) | 转发(0) |