⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 field.cpp

📁 提取各种NEMA0183格式数据的类编程。
💻 CPP
字号:
#include "nmea0183.h"

const CString& field( int desired_field_number, const CString& sentence )
{
   static CString return_string;

   return_string.Empty();

   int index                = 1; // Skip over the $ at the begining of the sentence
   int return_index         = 0;
   int current_field_number = 0;
   int string_length        = 0;

   string_length = sentence.GetLength();

   while( current_field_number < desired_field_number && index < string_length )
   {
      if ( sentence[ index ] == ',' || sentence[ index ] == '*' )
      {
         current_field_number++;
      }
      else
      {
         /*
         ** Do Nothing
         */
      }

      index++;
   }

   if ( current_field_number == desired_field_number )
   {
      while( index < string_length    &&
             sentence[ index ] != ',' &&
             sentence[ index ] != '*' &&
             sentence[ index ] != 0x00 )
      {
         return_string += sentence[ index ];
         index++;
      }
   }
   else
   {
      /*
      ** Do Nothing
      */
   }

   return( return_string );
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -