Atof (converts a string to a float number)
related functions
atoi, atol, strtodd, strtol, strtoul
header file
# include
define the function
double atof (const char * nptr);
function description
atof () scans the nptr parameter string, skip the leading space character, and do not begin to convert until a number or positive or negative sign is encountered, and then encounter a non-Number The conversion ends only when the word or string ends ('') and the result is returned. The nptr string can contain positive and negative numbers, decimal points, or E (e) to represent the exponential part, such as 123.456 or 123e-2.
return value
return the number of floating point types after conversion.
additional description
atof () is the same as the use of strtodd (nptr, (char **) null.
atoi (converts a string to an integer)
related functions
atof, atol, atrtodd, strtol, strtoul
header file
# include
define the function
int atoi (const char * nptr);
function description
atoi () scans the nptr parameter string and jumps Before the space character, it is not until a number or positive or negative sign starts to convert, and then when a non-number or string ends (''), the conversion ends, and the result is returned.
return value
return the converted integer number.
additional description
atoi () is the same as strtol (nptr, (char **) null, 10.
atol (convert string to integer)
related functions
atof, atoi, strtodd, strtol, strtoul
header file
# include
define the function
long atol (const char * nptr);
function description
atol () scans the nptr parameter string, Skip the leading space character until the conversion starts when a number or positive or negative sign is met, and then the conversion ends when a non-number or string ends (''), and the result is returned.
return value
return the converted long integer.
additional description
atol () is the same as strtol (nptr, (char **) null, 10.
gcvt (convert the float number to a string and rounding it out)
related functions
ECVT, fcvt, sprintf
header file
# include
definition function
char * gcvt (double number, size_t ndigits, char * BUF);
function description
GCV T () is used to convert the parameter number into an ASCII string. The parameter ndigits indicates the number of digits displayed. Gcvt () differs from ECVT () and fcvt () in that the string converted by gcvt () contains the decimal point or positive or negative sign. If the conversion is successful, the converted string will be placed in the space specified by the Buf pointer.
return value
Returns a string pointer. This address is the Buf pointer.
additional description
strtodd (converts a string to a floating point number)
related functions
atoi, atol, strtodd, strtol, strtoul
header file
# include
define the function
double strtodd (const char * nptr, char ** endptr);
function description
Strtodd () scans the nptr parameter string and skips the leading space character. Conversion is started only when a number or positive or negative sign is encountered until a non-number or string ends ('') and return the result. If the endptr value is not null, the character pointer in the nptr that is terminated when an exception occurs is returned by the endptr. The nptr string can contain positive and negative numbers, decimal points, or E (e) to represent the exponent part. Such as 123.456 or 123e-2.
return value
return the number of floating point types after conversion.
additional instructions
refer to atof ().
strtol (convert string to integer)
related functions
atof, atoi, atol, strtodd, strtoul
header file
# include
define a function
long int strtol (const char * nptr, char ** endptr, int base);
function description
strtol () the nptr string is converted to the Growth integer number based on the base parameter. The base parameter ranges from 2 to 36, or 0. The base parameter indicates the base mode. For example, if the base value is 10, the base value is 10. If the base value is 16, the base value is hexadecimal. When the base value is 0, the conversion is made using 10. However, if the '0x 'prefix character is encountered, the hexadecimal conversion is made using 16. At the beginning, strtol () scans the nptr parameter string, skips the leading space character, and starts conversion only when a number or positive or negative sign is encountered, and then ends when a non-number or string ends ('') end the conversion and return the result. If the endptr parameter is not null, the character pointer in the nptr that is terminated due to an exception is returned by the endptr.
return value
return the converted long integer. Otherwise, the error Code is returned and stored in errno.
additional description
the conversion string specified by erange is out of the valid range.
strtoul (convert string to unsigned long integer)
related functions
atof, atoi, atol, strtodd, strtol
header file
# include
define the function
unsigned long int strtoul (const char * nptr, char ** endptr, int base);
function description
strtoul () the nptr string is converted to an unsigned long integer number based on the base parameter. The base parameter ranges from 2 to 36, or 0. The base parameter indicates the base mode. For example, if the base value is 10, the base value is 10. If the base value is 16, the base value is hexadecimal. When the base value is 0, the conversion is made using 10. However, if the '0x 'prefix character is encountered, the hexadecimal conversion is made using 16. At the beginning, strtoul () scans the nptr parameter string, skips the leading space string, and starts conversion only when a number or positive or negative sign is encountered, and then ends when a non-number or string ends ('') end the conversion and return the result. If the endptr parameter is not null, the character pointer in the nptr that is terminated due to an exception is returned by the endptr.
return value
return the converted long integer. Otherwise, the error code is returned and stored in errno.
additional description
the conversion string specified by erange is out of the valid range.
toascii (convert an integer to a valid ASCII character)
related functions
isascii, toupper, tolower
header file
# include
define a function
int toascii (INT c)
function description
toascii () converts parameter C to a 7-bit unsign. Ed char value. The eighth digit is cleared. This character is converted to an ASCII character.
return value
the converted ASCII code value is returned.
tolower (converts uppercase letters to lowercase letters)
related functions
isalpha, toupper
header file
# include
define the function
int tolower (int c);
function description
If the parameter C is an upper-case letter, the corresponding lower-case letter is returned.
return value
return the converted lowercase letter. If no conversion is required, the C value is returned.
additional description
Toupper (converts lowercase letters to uppercase letters)
Related functions
Isalpha, tolower
Header file
# Include <ctype. h>
Define functions
Int toupper (int c );
Function Description
If the parameter C is a lowercase letter, the uppercase letter of the ing is returned.
Return Value
Returns the converted uppercase letter. If no conversion is required, the C value is returned.
Additional instructions
From: http://blog.csdn.net/greenerycn/archive/2007/06/11/1647945.aspx