atoi. McGraw-Hill The Complete Reference Fourth Edition
Διαφήμιση
Διαφήμιση
764
C + + : T h e C o m p l e t e R e f e r e n c e
atoi
The atof( ) function converts the string pointed to by str into a double value. The string must contain a valid floating-point number. If this is not the case, the returned value is undefined.
The number may be terminated by any character that cannot be part of a valid floatingpoint number. This includes white space, punctuation (other than periods), and characters other than E or e. This means that if atof( ) is called with "100.00HELLO", the value 100.00
will be returned.
Related functions are atoi( ) and atol( ).
#include <cstdlib> int atoi(const char * str);
atol
The atoi( ) function converts the string pointed to by str into an int value. The string must contain a valid integer number. If this is not the case, the returned value is undefined; however, most implementations will return zero.
The number may be terminated by any character that cannot be part of an integer number. This includes white space, punctuation, and characters. This means that if atoi( ) is called with "123.23", the integer value 123 will be returned, and the ".23" is ignored.
Related functions are atof( ) and atol( ).
#include <cstdlib> long atol(const char * str);
The atol( ) function converts the string pointed to by str into a long value. The string must contain a valid long integer number. If this is not the case, the returned value is undefined; however, most implementations will return zero.
The number may be terminated by any character that cannot be part of an integer number. This includes white space, punctuation, and characters. This means that if
atol( )
is called with "123.23", the long integer value 123L will be returned, and the ".23" is ignored.
Related functions are atof( ) and atoi( ).
bsearch
#include <cstdlib> void *bsearch(const void * key, const void *buf,
Λήψη
Διαφήμιση