c - Xcode 4.5 字符未显示在控制台框中,使用 C 语言中的 scanf()

标签 c xcode scanf xcode4.5

自从更新到 Xcode 4.5 后,我遇到了这个问题。

我在控制台框中输入了 4555,但控制台框中只显示了 4

我尝试了不同的输入参数,例如%d%f%c%s,都有同样的问题。

我不明白。如何解决?

我的源码是

#include <stdio.h>

int main()
{
    int input;
    // insert code here...

    printf("Hello, World!\n");
    printf("Please Enter Number : ");
    scanf("%d",&input);
    getchar();
    printf("Input is : %d",input);
    return 0;
}

控制台框显示:

>Hello, World!

>Please Enter Number : 4

>Input is : 4555

最佳答案

看来这是Xcode 4.5的一个bug。见:

There's a discussion of this issue on Apple's paid developer forums. It's a bug in Xcode 4.5. Apple's engineers are looking into the issue, but there's no fix yet.

There are two workarounds. The first workaround is to run your command-line app from the Terminal. In the Xcode project navigator select your executable from the Products folder. Right-click and choose Show in Finder. Double-click the executable in the Finder to launch it in the Terminal.

The second workaround is to install Xcode 4.4. Choose Xcode > Open Developer Tool > More Developer Tools to access Apple's developer downloads site.

Yes, this is a confirmed regression from 4.4, and we're tracking it internally. It is really unfortunate that this slipped in, but we'll get it fixed ASAP.

关于c - Xcode 4.5 字符未显示在控制台框中,使用 C 语言中的 scanf(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12635860/

相关文章:

c - 神奇的段错误?

ios - 如何获取 AppIcon 的 UIImage?

c - scanf_s() 缓冲区在哪里定义?

c - 如何将文件中的数字扫描到数组中?

c - 空间究竟如何与 scanf 一起工作?

C - 将 execvp 与用户输入一起使用

C 编程 : How can I check if given number is exactly for digits, 不多/不少?

c - C中这两个有什么区别?

objective-c - 如何检查xcode中返回的空对象

ios - Swift:如何调用其中一个参数是 completionHandler 的函数