Did you read my post ?
That is a standard behaviour. If you want to convert an integer (let's say 3) in binary string, you won't have the zeros in front of the number, that sounds logical isn't ?
So, when you convert 3 into a binary string, it's logical that you get '11' and not '0011' (how can the compiler knows that you want 2 zeros at the begining of the string). The same when you convert 1 into a string, you will get '1'.
I think you want to convert a binary string into its value ? Right ?
Maybe you can write a simple function to do that:
int BoolStringToVal(char* szString)<br />
int Value = 0;<br />
for (int Index=strlen(szString)-1; Index>=0; Index--)<br />
int BinValue = 1 << (Index - strlen(szString) + 1 );<br />
if (szString[Index])<br />
Value += BinValue ;<br />
return Value;<br />
So, what it does is look for each char in the string and if this char is 1 then we add its corresponding value to the total value. The code has not been tested so I'm not sure if this will work, but you got the principle.
Actually, am getting data from the machine as 0x03 0x10 0x82 0x10..... and length of the buffer is varying, as Length:108 or 256 or....so how to proceed further to parse the data and store the data in an array. do we have any Active X control for parsing the data?
do we have any Active X control for parsing the data?
how an activeX could help you there ???
well, you reposted your question, but you don't really say much once again.
am getting data from the machine as 0x03 0x10 0x82 0x10
this doesn't mean anything (or it could mean everything) depending on haw you want to interpret those bytes...
that's why i asked you the format of the datas supposed to be received...
please precise the type on how you receive those data, how you want to change them, tell also if there are some important thing to read from the stream...