06.08.2013 Views

pSOSystem System Calls - Read

pSOSystem System Calls - Read

pSOSystem System Calls - Read

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

strtol pREPC+ <strong>System</strong> <strong>Calls</strong><br />

strtol Converts a string to a long integer.<br />

#include <br />

long strtol(<br />

const char *nptr, /* string */<br />

char **endptr, /* string conversion terminator */<br />

int base /* conversion base */<br />

)<br />

Description<br />

Arguments<br />

Return Value<br />

Error Codes<br />

The strtol() function converts the initial portion of a string (nptr) to long int<br />

representation, according to the radix specified by base. This function ignores<br />

leading white spaces, and the string can contain either a + or a -.<br />

nptr Points to the string to be converted.<br />

endptr An output parameter. If endptr is null, this function is equivalent to<br />

the atol() function. If endptr is not null, it points to a pointer to the<br />

character in str that terminated the scan.<br />

base Specifies the base of the number system assumed by the function.<br />

base must be either 0 or within the range 2 through 36. If it is 0, the<br />

string itself is used to determine its base. If nptr begins with the<br />

character 0, base eight is assumed; if nptr begins with 0x or 0X, base<br />

sixteen is assumed; otherwise base ten is assumed.<br />

This function returns the converted value. If the conversion fails, this function<br />

returns a 0 and sets errno.<br />

Refer to Appendix B.<br />

3-168 <strong>pSO<strong>System</strong></strong> <strong>System</strong> <strong>Calls</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!