Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

binary numbers

Status
Not open for further replies.

FrozenLight

Programmer
Mar 15, 2002
8
CA
How do you specify that a number is in binary notation?
Ex: variable a= 10010101

How do you convert a number in ascii format to an int or long type?

Thanks
 
char* endPtr;
int val = strtol(buffer,endPtr,2);

also, check out the faq I wrote on binary numbers for beginners.

faq205-1579

Matt
 
To convert a string to integer....

char *str;
int val;
.
.
.
val = atoi(str);


cheers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top