It's probably easy for most of you but ... is there and easy way to get a BSC from a char array ... ex.: char buffer[20]; ?
thank you !
It's probably easy for most of you but ... is there and easy way to get a BSC from a char array ... ex.: char buffer[20]; ?
thank you !
You mean like using a for loop to subscript the elements of your array?
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
If I understand the explanations, I have to loop and do an addition with the binary value of each char (on the client side and on the server side). Then I'll know if this is the same exact value.
ex:
a[0] = 'A';
a[1] = 'B';
a[2] = 'C';
a[3] = 'D';
a[4] = 'E';
a[5] = 'F';
A + B + C + D + E + F = something
Any way to do this ?
Last edited by trooper; 03-28-2011 at 12:52 PM.
You mean like that?Code:int sum = 0; for(int i = 0;i < 6;++i) sum += a[i];
If you understand what you're doing, you're not learning anything.
Humm if we can add char value into an int, I'll try this ... thanks
A char value is just a small (1 byte) data type. The character representation (e.g. 'A' or 'B') is just a convenience for the programmer. The character constants just map to the underlying character set which translates it into a value.
Check out: www.asciitable.com
If you understand what you're doing, you're not learning anything.
I think that the formula as was looking for looks like ...
BSC = 0;
BSC ^= a[0];
BSC ^= a[1];
.
.
.
.
.
then i will need to get a string out of BSC