I checked back in the forum and found you keep asking repeated questions over an over about conversions between the bases. I would recommend paying attention to what you are being told and learn how to do this rather than trying to get us to do the work every time (Maybe read up on it!)
rwyoung
Joined: 12 Nov 2003 Posts: 563 Location: Lawrence, KS USA
Posted: Thu Jul 08, 2004 1:21 pm
This is 100% untested and off the top of my head so it may not even compile:
Code:
// st is character array containing binary number of interest
// example st[] = "01011010" which is 0x5A
// i is int8 and result is int16
i=0;
result = 0L;
do {
shift_left(&result,2,st[i]-'0');
} while(st[++i]);
Add a more detailed stop condition to the do-while loop to prevent more than 16 characters from being evaluated, or whatever is appropriate for your data set. _________________ Rob Young
The Screw-Up Fairy may just visit you but he has crashed on my couch for the last month!
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum