Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!mit-eddie!genrad!panda!enmasse!drilex!axiom!linus!philabs!aecom!naftoli From: naftoli@aecom.UUCP (Robert N. Berlinger) Newsgroups: net.unix,net.bicycle Subject: Re: strtol() Message-ID: <580@aecom.UUCP> Date: Tue, 4-Nov-86 19:53:55 EST Article-I.D.: aecom.580 Posted: Tue Nov 4 19:53:55 1986 Date-Received: Wed, 5-Nov-86 22:42:58 EST References: <1366@mit-trillian.MIT.EDU> Organization: Albert Einstein College of Medicine Lines: 45 Xref: mnetor net.unix:6149 net.bicycle:2104 > What does strtol() do? This is from the AT&T manual. SYNOPSIS long strtol (str, ptr, base) char *str, **ptr; int base; DESCRIPTION Strtol returns as a long integer the value represented by the character string pointed to by str. The string is scanned up to the first character inconsistent with the base. Leading ``white-space'' characters (as defined by isspace in ctype(3C)) are ignored. If the value of ptr is not (char **)NULL, a pointer to the character terminating the scan is returned in the location pointed to by ptr. If no integer can be formed, that location is set to str, and zero is returned. If base is positive (and not greater than 36), it is used as the base for conversion. After an optional leading sign, leading zeros are ignored, and ``0x'' or ``0X'' is ignored if base is 16. If base is zero, the string itself determines the base thusly: After an optional leading sign a leading zero indicates octal conversion, and a leading ``0x'' or ``0X'' hexadecimal conversion. Otherwise, decimal conversion is used. Truncation from long to int can, of course, take place upon assignment or by an explicit cast. Hope that helps. -- Robert N. Berlinger Systems Analyst Scientific Computing Center Albert Einstein College of Medicine UUCP: ...{philabs,cucard,pegasus,ima,rocky2}!aecom!naftoli Compuserve: 73047,741 Easylink: 62956067 GEnie: R.Berlinger