2

I have got this problem since updated to Xcode 4.5.

I typed 4555 in console box but it show only 4 in console box.

I tried different input parameters such as %d, %f, %c and %s, all have the same problem.

I don't get it. How to fix it?

My source code is

#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;
}

and console box shows:

>Hello, World!

>Please Enter Number : 4

>Input is : 4555
Hailei
  • 42,163
  • 6
  • 44
  • 69

1 Answers1

1

It seems that this is a bug of Xcode 4.5. See:

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.

Hailei
  • 42,163
  • 6
  • 44
  • 69
  • Recently a lot of minor bugs are found for each of the 0.1 releases for Xcode, which makes Apple publish patch versions very quickly... 4.4 (Jul 25) -> 4.4.1 (Aug 7), and 4.3 (Feb 16) -> 4.3.1 (Mar 8). I wonder when will 4.5.1 come out? :) – Hailei Sep 28 '12 at 08:31
  • "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." by Mark Szymczyk // It's worked – Nuttanon Pornpipak Sep 28 '12 at 08:44
  • Yes, that's a workaround. It still needs fix by Apple, or it would be very inconvenient for the developers. – Hailei Sep 28 '12 at 08:47