unit1.cpp

来自「CRC16 源程序」· C++ 代码 · 共 52 行

CPP
52
字号
//---------------------------------------------------------------------------
#include <vcl.h>#pragma hdrstop#include "Unit1.h"//---------------------------------------------------------------------------#pragma package(smart_init)#pragma resource "*.dfm"TForm1 *Form1;//---------------------------------------------------------------------------__fastcall TForm1::TForm1(TComponent* Owner)        : TForm(Owner){}//---------------------------------------------------------------------------void __fastcall TForm1::Button2Click(TObject *Sender){    Close();}//---------------------------------------------------------------------------__fastcall TForm1::fun_SerialCRC(uchar *puchMsg, uint usDataLen){    uchar uchCRCHi;    uchar uchCRCLo;    uint uIndex ;    uchCRCHi = 0xff;    uchCRCLo = 0xff;    while (usDataLen--)    {        uIndex = uchCRCHi ^ *puchMsg++;        uchCRCHi = uchCRCLo ^ auchCRCHi[uIndex];        uchCRCLo = auchCRCLo[uIndex];    }    return (uchCRCHi << 8 | uchCRCLo);}//---------------------------------------------------------------------------void __fastcall TForm1::Button1Click(TObject *Sender){    String st1 = Edit1->Text;   //这里调试通不过    String st2 = fun_SerialCRC(&st1,12);   //这里调试通不过    Edit2->Text = st2;}//---------------------------------------------------------------------------

⌨️ 快捷键说明

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