# Block Sum Check

• 03-28-2011
trooper
Block Sum Check
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 !
• 03-28-2011
Salem
You mean like using a for loop to subscript the elements of your array?
• 03-28-2011
trooper
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 ?
• 03-28-2011
itsme86
Code:

```int sum = 0; for(int i = 0;i < 6;++i)   sum += a[i];```
You mean like that?
• 03-28-2011
trooper
Humm if we can add char value into an int, I'll try this ... thanks
• 03-28-2011
itsme86
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
• 03-28-2011
trooper
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