checksum.cpp

来自「提取各种NEMA0183格式数据的类编程。」· C++ 代码 · 共 18 行

CPP
18
字号
#include "nmea0183.h"

BYTE ComputeChecksum( const CString &line_to_parse )
{
   BYTE checksum_value = 0;

   int string_length = line_to_parse.GetLength();
   int index = 1; // Skip over the $ at the begining of the sentence

   while( index < string_length && line_to_parse[ index ] != '*' )
   {
      checksum_value ^= line_to_parse[ index ];
      index++;
   }

   return( checksum_value );
}

⌨️ 快捷键说明

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