{"id":50548,"date":"2022-11-05T03:45:55","date_gmt":"2022-11-04T19:45:55","guid":{"rendered":"http:\/\/www.idc.net\/help\/50548\/"},"modified":"2022-11-05T03:45:55","modified_gmt":"2022-11-04T19:45:55","slug":"%e5%87%bd%e6%95%b0linux%e4%b8%ad-atoi-%e5%87%bd%e6%95%b0%e7%9a%84%e4%bd%bf%e7%94%a8%e4%bb%8b%e7%bb%8d%ef%bc%88linuxatoi%ef%bc%89","status":"publish","type":"post","link":"https:\/\/idc.net\/help\/50548\/","title":{"rendered":"\u51fd\u6570Linux\u4e2d atoi \u51fd\u6570\u7684\u4f7f\u7528\u4ecb\u7ecd\uff08linuxatoi\uff09"},"content":{"rendered":"<p>Linux\u7684atoi\u51fd\u6570\u662f\u4e00\u79cd\u683c\u5f0f\u5316\u7684\u5b57\u7b26\u4e32\u51fd\u6570\uff0c\u5b83\u53ef\u4ee5\u4ece\u5b57\u7b26\u4e32\u4e2d\u8bfb\u53d6\u6570\u636e\uff0c\u5c06\u5b57\u7b26\u4e32\u8f6c\u6362\u4e3aint\u7c7b\u578b\u7684\u6570\u5b57\uff0c\u8fd9\u662f\u5176\u4e2d\u7684\u4e00\u79cd\u4f7f\u7528\u65b9\u6cd5\u3002atoi\u51fd\u6570\u6700\u5e38\u7528\u4e8e\u5b57\u7b26\u4e32\u548c\u6570\u5b57\u8f6c\u6362\uff0c\u4f8b\u5982\u5c06\u5b57\u7b26\u4e32\u8f6c\u6362\u4e3a\u6570\u5b57\u3002\u5b83\u901a\u5e38\u4f1a\u88ab\u7528\u4f5c\u89e3\u6790\u547d\u4ee4\u884c\u53c2\u6570\u4e2d\u7684\u5b57\u7b26\u4e32\u9879\u3002<\/p>\n<\/p>\n<p>atoi\u51fd\u6570\u7684\u539f\u578b\u662f\uff1aint atoi (const char *str)\uff1b\u5176\u4e2d\u7684\u53c2\u6570\u662f\u5b57\u7b26\u4e32\u800c\u8fd4\u56de\u503c\u662f\u6574\u6570\u3002\u4e0e\u5927\u591a\u6570\u7c7b\u4f3c\u7684\u5b57\u7b26\u4e32\u8f6c\u6362\u51fd\u6570\u4e00\u6837\uff0catoi\u51fd\u6570\u5c06\u6570\u5b57\u5b57\u7b26\u8f6c\u6362\u4e3a\u6574\u6570\uff0c\u4f8b\u5982\u201c101\u201d\u5c06\u88ab\u8f6c\u6362\u4e3a101\u3002<\/p>\n<\/p>\n<p>\u4e0b\u9762\u4f7f\u7528\u4e00\u4e2a\u7b80\u5355\u7684C\u8bed\u8a00\u793a\u4f8b\u6765\u8bf4\u660e\u5982\u4f55\u4f7f\u7528atoi\u51fd\u6570\uff1a<\/p>\n<\/p>\n<p>#include <\/p>\n<\/p>\n<p>#include <\/p>\n<\/p>\n<p>int main (void)<\/p>\n<p>{<\/p>\n<p> char str[]=\u201d12345\u2033;<\/p>\n<p> int result;<\/p>\n<\/p>\n<p> result = atoi(str);<\/p>\n<p> printf(\u201cThe numerical value of given string is = %d\\n\u201d, result);<\/p>\n<p> return 0;<\/p>\n<p>}<\/p>\n<\/p>\n<p>\u8fd0\u884c\u7ed3\u679c\u4e3a\uff1aThe numerical value of given string is = 12345<\/p>\n<\/p>\n<p>\u4ece\u4e0a\u9762\u7684\u4f8b\u5b50\u53ef\u4ee5\u770b\u51fa\uff0c\u4f7f\u7528atoi\u51fd\u6570\u4e3b\u8981\u7528\u4e8e\u5728\u547d\u4ee4\u884c\u7a0b\u5e8f\u4e2d\u505a\u5b57\u7b26\u4e32\u548c\u6570\u5b57\u4e4b\u95f4\u7684\u8f6c\u6362\uff0c\u6bd4\u5982\uff1a\u53c2\u6570\u89e3\u6790\u51fd\u6570\uff0c\u6570\u636e\u683c\u5f0f\u8f6c\u6362\u7b49\u3002<\/p>\n<\/p>\n<p>\u603b\u4e4bLinux\u7684atoi\u51fd\u6570\u662f\u4e2a\u6bd4\u8f83\u5b9e\u7528\u7684\u51fd\u6570\uff0c\u5728\u4e00\u4e9b\u7a0b\u5e8f\u5f00\u53d1\u4e2d\u80fd\u591f\u5e2e\u52a9\u5f00\u53d1\u8005\u66f4\u597d\u7684\u5904\u7406\u5b57\u7b26\u4e32\u53ca\u76f8\u5173\u7684\u8f6c\u6362\uff0c\u4e14\u5177\u6709\u826f\u597d\u7684\u6027\u80fd\u548c\u8f7b\u91cf\u7684\u7a7a\u95f4\u5360\u7528\uff0c\u6bd4\u8f83\u9002\u7528\u4e8e\u4e00\u4e9b\u64cd\u4f5c\u7cfb\u7edf\u4e0d\u9700\u8981\u590d\u6742\u7684\u529f\u80fd\u7684\u8fd9\u7c7b\u5e94\u7528\u4e2d\u3002<\/p>\n<p><a href=\"http:https:\/\/idc.net\/\">\u9999\u6e2f\u670d\u52a1\u5668<\/a>\u9996\u9009\u540e\u6d6a\u4e91\uff0c2H2G\u9996\u670810\u5143\u5f00\u901a\u3002<br \/>\u540e\u6d6a\u4e91\uff08www.IDC.Net\uff09\u63d0\u4f9b\u7b80\u5355\u597d\u7528\uff0c\u4ef7\u683c\u539a\u9053\u7684\u9999\u6e2f\/\u7f8e\u56fd\u4e91\u670d\u52a1\u5668\u548c\u72ec\u7acb\u670d\u52a1\u5668\u3002IDC+ISP+ICP\u8d44\u8d28\u3002ARIN\u548cAPNIC\u4f1a\u5458\u3002\u6210\u719f\u6280\u672f\u56e2\u961f15\u5e74\u884c\u4e1a\u7ecf\u9a8c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Linux\u7684atoi\u51fd\u6570\u662f\u4e00\u79cd\u683c\u5f0f\u5316\u7684\u5b57\u7b26\u4e32\u51fd\u6570\uff0c\u5b83\u53ef\u4ee5\u4ece\u5b57\u7b26\u4e32\u4e2d\u8bfb\u53d6\u6570\u636e\uff0c\u5c06\u5b57\u7b26\u4e32\u8f6c\u6362\u4e3aint\u7c7b\u578b\u7684\u6570\u5b57\uff0c\u8fd9 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[34],"tags":[],"class_list":["post-50548","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/50548","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/comments?post=50548"}],"version-history":[{"count":0,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/50548\/revisions"}],"wp:attachment":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/media?parent=50548"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/categories?post=50548"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/tags?post=50548"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}