【お知らせ】この部分は英語原文のみでの提供となります。何卒ご了承ください。
2.1.6.3 atoi
Contents
Description
Converts string to an integer.
Syntax
int atoi( LPCSTR lpcsz )
Parameters
- lpcsz
- [input] the string to convert.
Return
an integer value. If conversion can not be made, zero is returned.
Examples
EX1
// This is a self contained sample program for the function atoi, // To run the program, enter the following command in the Script window: // atoi_ex1 // When it runs, the following meassages will be printed: // Converted "-123" to -123 // Converted "3.45" to 3 // Converted "abc" to 0 // void atoi_ex1() { int ii; char sz1[] = "-123"; ii = atoi(sz1); printf("Converted \"%s\" to %d\n", sz1,ii); char sz2[] = "3.45"; ii = atoi(sz2); printf("Converted \"%s\" to %d\n", sz2,ii); char sz3[] = "abc"; ii = atoi(sz3); printf("Converted \"%s\" to %d\n", sz3,ii); }
Remark
Converts string to an integer.
See Also
Header to Include
origin.h