In the C language where did they come up with the name atoi
for converting a string to an integer? The only thing I can think of is Array To Integer for an acronym but that doesn't really make sense.
在C语言中,他们是如何想出将字符串转换为整数的atoi名称的呢?我能想到的唯一的事情是数组到整数的缩写,但这并没有什么意义。
2 个解决方案
#1
112
It means Ascii to Integer. Likewise, you can have atol
for Ascii to Long, atof
for Ascii to Float, etc.
它的意思是Ascii到整数。同样,您可以有atol for Ascii to Long, atof for Ascii to Float,等等。
A Google search for 'atoi "ascii to integer"' confirms this on several pages.
谷歌搜索“atoi”ascii到integer“确认了这一点。
I'm having trouble finding any official source on it... but in this listing of man pages from Third Edition Unix (1973) collected by Dennis Ritchie himself, it does contain the line:
我找不到任何官方消息来源……但是在这张由Dennis Ritchie自己收集的第三版Unix(1973)的手册列表中,确实包含了如下内容:
atoi(III): convert ASCII to integer
atoi(III):将ASCII转换为整数
In fact, even the first edition Unix (ca 1971) man pages list atoi
as meaning Ascii to Integer.
事实上,即使是第一版Unix (ca 1971)手册页列表atoi也表示Ascii到整数。
So even if there isn't any documentation more official than man pages indicating that atoi
means Ascii to Integer (I suspect there is and I just haven't been able to locate it), it's been Ascii to Integer by convention at least since 1971.
因此,即使没有任何文档比man页面更正式地表明atoi是指Ascii到Integer(我怀疑有,而且我还没能找到它),至少从1971年以来,它一直是Ascii到Integer的。
#2
-1
I griefly believe that function atoi means ascii to integer.
我悲伤地认为函数atoi是ascii到整数的意思。
#1
112
It means Ascii to Integer. Likewise, you can have atol
for Ascii to Long, atof
for Ascii to Float, etc.
它的意思是Ascii到整数。同样,您可以有atol for Ascii to Long, atof for Ascii to Float,等等。
A Google search for 'atoi "ascii to integer"' confirms this on several pages.
谷歌搜索“atoi”ascii到integer“确认了这一点。
I'm having trouble finding any official source on it... but in this listing of man pages from Third Edition Unix (1973) collected by Dennis Ritchie himself, it does contain the line:
我找不到任何官方消息来源……但是在这张由Dennis Ritchie自己收集的第三版Unix(1973)的手册列表中,确实包含了如下内容:
atoi(III): convert ASCII to integer
atoi(III):将ASCII转换为整数
In fact, even the first edition Unix (ca 1971) man pages list atoi
as meaning Ascii to Integer.
事实上,即使是第一版Unix (ca 1971)手册页列表atoi也表示Ascii到整数。
So even if there isn't any documentation more official than man pages indicating that atoi
means Ascii to Integer (I suspect there is and I just haven't been able to locate it), it's been Ascii to Integer by convention at least since 1971.
因此,即使没有任何文档比man页面更正式地表明atoi是指Ascii到Integer(我怀疑有,而且我还没能找到它),至少从1971年以来,它一直是Ascii到Integer的。
#2
-1
I griefly believe that function atoi means ascii to integer.
我悲伤地认为函数atoi是ascii到整数的意思。