#include
unsigned char calc_checksum(const char *s)
{
unsigned char result;
result = 0;
s++; // Skip dollar sign
while ((*s != '*') && (*s != '\0'))
result ^= *s++;
return result;
}
int main()
{
unsigned char checksum;
checksum = calc_checksum
("$GPRMC,235947.000,V,0000.0000,N,00000.0000,E,,,041299,,*");
printf("Checksum = %02X\n", checksum);
return 0;
}
I want same output in C# as i am getting in this c++ code. Please reply soon, Its very urgent.

VulpesPosted Oct 11, 2013, 7:33 AM
Puneet GuptaPosted Oct 11, 2013, 8:06 AM
Thanks,
Puneet Gupta
VulpesPosted Oct 11, 2013, 7:08 AM
Checksum = 1D
as the C++ version.
You'll need to compile with the /unsafe switch or 'use unsafe code' if building from VS: