本文整理汇总了C++中StringTokenizer::NextToken方法的典型用法代码示例。如果您正苦于以下问题:C++ StringTokenizer::NextToken方法的具体用法?C++ StringTokenizer::NextToken怎么用?C++ StringTokenizer::NextToken使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringTokenizer
的用法示例。
在下文中一共展示了StringTokenizer::NextToken方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Execute
//---------------------------------------------------------------------------
void __fastcall ThreadLecturaGPS::Execute()
{
double UTMNorthing;
double UTMEasting;
char UTMZone[4];
int ReferenceEllipsoid = 23;
double Lat;
double Long;
// double time;
double Latitud, lat1;
double Longitud, lon1;
AnsiString Dir_Longitud;
AnsiString Trama;
AnsiString TramaCorrecta;
//for (int i=0; i<10;i++)
CPS->RecibirTramaGPS();
while (!Fin){
try{
Trama = AnsiString(CPS->RecibirTramaGPS());
//Obtenemos las coordenadas GGA
StringTokenizer *ST = new StringTokenizer(Trama, ",");
TramaCorrecta = ST->NextToken();
//Nos aseguramos que la trama GGA es la buena comparando la cabecera
//Para asegurarnos mas todavia, convendria contar el numero de comas de la trama.
// GGA Trimble --> 14 comas
if ((AnsiString("$GPGGA")) == TramaCorrecta){
if (LongitudCorrecta(14,Trama)){
time = (ST->NextToken());//.ToDouble();
Latitud = (ST->NextToken()).ToDouble();
ST->NextToken();
Longitud =(ST->NextToken()).ToDouble();
Dir_Longitud = ST->NextToken();
ST->NextToken();//fix
ST->NextToken();//n sat
ST->NextToken();//DOP
UTM_Height = ST->NextToken().ToDouble();
delete ST;
lat1 = floor(Latitud/100);
Latitud = lat1+(Latitud/100-lat1)*100/60;
lon1 = floor(Longitud/100);
Longitud = lon1+(Longitud/100-lon1)*100/60;
//East Longitudes are positive, West longitudes are negative.
//North latitudes are positive, South latitudes are negative
if (Dir_Longitud == AnsiString("W"))
LLtoUTM(ReferenceEllipsoid, Latitud, -Longitud, UTMNorthing, UTMEasting, UTMZone);
else
LLtoUTM(ReferenceEllipsoid, Latitud, Longitud, UTMNorthing, UTMEasting, UTMZone);
/***************************************************************/
/******* Actualizo ls variables de clase **********************/
/***************************************************************/
UTM_North = UTMNorthing;
UTM_East = UTMEasting;
}//if Longitud correcta
}//if
}catch(Exception &E){/*MessageBox(NULL,"Error al leer la posición","ERROR",MB_OK | MB_ICONERROR);*/
}
}
CPS->CerrarPuerto();
delete CPS;
}