Xref: utzoo comp.std.c:4043 comp.lang.c:34855 Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!uunet!auspex!guy From: guy@auspex.auspex.com (Guy Harris) Newsgroups: comp.std.c,comp.lang.c Subject: Re: "1234" ==> 1234 (char * ==> int) Message-ID: <4907@auspex.auspex.com> Date: 19 Dec 90 19:01:32 GMT References: <1990Dec12.215359.5378@cs.utk.edu> <1990Dec13.044726.14433@zoo.toronto.edu> Followup-To: comp.lang.c Organization: Auspex Systems, Santa Clara Lines: 8 >Use the atoi() or atol() function from the C library. Or, if you have it, "strtol()" (if you have ANSI C, you have it; even if you don't have ANSI C, you may have it). "strtol()" has the advantage that it tells you where it stopped scanning the string, so you can check whether the string was a number or just started out as one (e.g., you may not want to just convert "1234motorway" into 1234; you may want to let the user know that it's not a number).