首页 文章
  • -5 votes
     answers
     views

    C - atoi提供虚假 Value

    我想我以错误的方式使用了ATOI功能 . cout << endl <<“pch”<< pch“显示3为例,b = atoi(pch)在终端显示一个奇怪的符号,在调试器中显示”\ xcorrect number“ . (例如”\ x2“表示pch = 2) . 任何想法为什么? 类 void Complex::input(std::string& b)...
  • 0 votes
     answers
     views

    谁能向我解释为什么这个atoi命令有效以及如何工作

    我用atoi命令编写了一个非常基本的c代码,然后执行它 . void main (void) { int length; length = atoi("Content: 111"); printf("atoi(\"Content: 111\") = %d\n",length); length = at...
  • 6 votes
     answers
     views

    关于错误的atoi()的行为,我可以假设什么?

    标准C库函数 atoi 在ISO 9899:2011中记录为: 7.22.1数字转换函数1 atof,atoi,atol和atoll函数不需要影响错误中整数表达式errno的值 . 如果无法表示结果的值,则行为未定义 . ...... 7.22.1.2 atoi,atol和环礁功能概要#include <stdlib.h>int atoi(const char * nptr);lo...
  • 2 votes
     answers
     views

    为什么atoi功能不起作用?

    该程序停止工作 . 即使我只放了一个int . 我尝试了很多不同的方法,但无法弄清楚出了什么问题 . 我试图输入由空格分隔的整数 . 可以有任何整数 . #include<stdio.h> #include<stdlib.h> int main(void) { int i,j=0; int b[100]; char a[100]; fget...
  • 0 votes
     answers
     views

    错误的值 - 将大字符分解为int数组

    我有一个非常大的字符串,其中包含2位数字和空格,顺序为xx xx xx ... etc' . 我正在尝试将每个数字转换为数字到int并存储在20x20 int数组中 . 对于这个任务,我使用memcpy来表示字符串的前2位数字,atoi从char转换为int和我编写的内部函数,它将每个字符串“left”移动到圆形 . 它适用于类似60号码的东西,然后在程序结束时得到错误的号码 . 这是代码: #i...
  • 0 votes
     answers
     views

    C操作无符号的Ints - 整数溢出

    我在简单的C程序中试验unsigned int数据类型和main方法参数 . 作为一个实验,我编写了一个程序,它从命令行获取一个int数作为main方法的参数,并将该数字和0之间的每个整数相加 . 例如 . 当n> 0时,程序计算f(n)=(1 2 3 ... n)有效 #include <stdio.h> #include <stdlib.h> const uns...
  • -1 votes
     answers
     views

    C,atoi()生成分段错误

    我正在使用atoi()从头部获取状态代码,但它不能使用以下输入: " 404 Not Found\r\nContent-type: text/html\r\nDate: Thu, 12 Dec 2013 20:53:22 GMT\r\nConnection: close\r\n\r\n" Shouldn't it stop reading at the first non-nu...

热门问题