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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Convert string to int

Status
Not open for further replies.

tmoses

MIS
Dec 4, 2001
98
US
Hi im a student and was wondering if their is a clean way to do a string to int conversion. I know how to take a char and put it into its ascii int value but i was wondering if their was any function in the ansi standard that would do this. I have used sprintf for int to string but could not seem to find one for the other way round. any help would be appreciated <br>
<br>
thanks<br>
tom moses
 
int atoi(char *string)is an ANSI standard subroutine, also<br>
long atol(char *string).<br>
<br>
Mix Software in Dallas (800)333-0330 used to sell a decent ANSI C compiler for $19.95. It isn't production quality and only runs on MS-DOS, but it works. The book alone is worth the price because it has complete documentation on C and all C functions, including some non-ANSI. There was a tutorial for $29.95 called Workout C, which includes the book, the compiler and the tutorial. I think Workout C also included the debugger. I bought mine in 1989 and almost wore the book out (its a paperback), so bought another.
 
hey thanks alot, i checked out the functions and the ran great. You saved me alot of time and hassle. Ill check those books out in a comple of days after i get through all of my exams. <br>
<br>
thanks again<br>
tom moses
 
There is a function atoi() which takes a string as a parameter and returns integer value. itoa() functions does the other way round. Was that your question ?<br>
Thanx<br>
Siddhartha Singh<br>
<A HREF="mailto:ssingh@aztecsoft.com">ssingh@aztecsoft.com</A>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top