GPS定位中n文件读取

这是读取n文件的中间代码,比较优秀。 

for (int j=1;j<8;j++)      //这个循环用的绝壁优秀
	{
		getline(fin,str);
		switch(j)
		{

		case 1: 
			NAVREC[numofi].dIODE		=atof(str.substr(3,19).c_str());
			NAVREC[numofi].dCrs		=atof(str.substr(22,19).c_str());
			NAVREC[numofi].dDetlaN		=atof(str.substr(41,19).c_str());
			AVREC[numofi].dM0		=atof(str.substr(60,19).c_str());			break;			
		case 2:
			NAVREC[numofi].dCuc		=atof(str.substr(3,19).c_str());
			NAVREC[numofi].d_e		=atof(str.substr(22,19).c_str());
			NAVREC[numofi].dCus		=atof(str.substr(41,19).c_str());
			NAVREC[numofi].dSqurtA		=atof(str.substr(60,19).c_str());	                break;	
		case 3:
			NAVREC[numofi].dTOE		=atof(str.substr(3,19).c_str());
			NAVREC[numofi].dCic		=atof(str.substr(22,19).c_str());
			NAVREC[numofi].dOmega		=atof(str.substr(41,19).c_str());
			NAVREC[numofi].dCis		=atof(str.substr(60,19).c_str());	                break;	
		case 4:	
			NAVREC[numofi].d_i0		=atof(str.substr(3,19).c_str());
			NAVREC[numofi].dCrc		=atof(str.substr(22,19).c_str());
			NAVREC[numofi].d_omega		=atof(str.substr(41,19).c_str());
			NAVREC[numofi].dOmegaDot	=atof(str.substr(60,19).c_str());
                        break;	
		case 5:
			NAVREC[numofi].d_iDot		=atof(str.substr(3,19).c_str());
			NAVREC[numofi].dCodesOnL2Channel=atof(str.substr(22,19).c_str());
			NAVREC[numofi].dGPSWeek		=atof(str.substr(41,19).c_str());
			NAVREC[numofi].dL2PDateFlag	=atof(str.substr(60,19).c_str());
                        break;	    
		case 6:
			NAVREC[numofi].dSVAccuracy	=atof(str.substr(3,19).c_str());
			NAVREC[numofi].dSVHealth	=atof(str.substr(22,19).c_str());
			NAVREC[numofi].dTGD		=atof(str.substr(41,19).c_str());
			NAVREC[numofi].dIODC		=atof(str.substr(60,19).c_str());
                        break;	
		case 7:
			NAVREC[numofi].dTransmissionTimeOfMessage=atof(str.substr(3,19).c_str());
			NAVREC[numofi].dFitInterval	=atof(str.substr(22,19).c_str());
//			NAVREC.dSpare1		        =atof(str.substr(41,19).c_str());
//			NAVREC.dSpare2		        =atof(str.substr(60,19).c_str());
                        break;	
               default:
                        printf("error\n");
                        break;

}	

  • 0
    点赞
  • 13
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值