checksum.cpp

来自「来自网络,国外网友做的,vc++代码,测试过,表示感谢. 可以读取串口GPS数」· 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 + -
显示快捷键?