Re: input from console window in Xcode --SOLVED
Re: input from console window in Xcode --SOLVED
- Subject: Re: input from console window in Xcode --SOLVED
- From: "McLaughlin, Michael P." <email@hidden>
- Date: Wed, 23 Jul 2014 12:16:48 +0000
- Thread-topic: input from console window in Xcode --SOLVED
I am embarrassed to say that I found the solution and it does me no
credit. For a long time, I have been in the habit of building my Release
configs with debugging turned off thinking that it *might* increase speed.
When I turned it on, the console window started behaving properly.
Personally, I think that this is still a kind of bug. I/O and debugging
should be distinct, yes? In Xcode, they have different panes.
‹
Michael P. McLaughlin
On 7/22/14, 4:37 PM, "Fritz Anderson" <email@hidden> wrote:
>On 22 Jul 2014, at 3:06 PM, McLaughlin, Michael P. <email@hidden>
>wrote:
>
>> When I make a command-line tool from the template which reads from
>>stdin, I can input data from the console pane but, with the Release
>>config, output to console is OK but I cannot input. All I get is the
>>blinking cursor (which never moves).
>>
>> However, if I exit Xcode and open the Release executable in Terminal,
>>everything works as designed/expected. I saw this again today with a
>>C/Flex/Bison (3.0.2) app.
>>
>> I thought for sure someone had commented on this but I could not find
>>it (so thought it must be just me).
>
>Works for me on Xcode 5.1.1 and later.
>
>I created a project for OS X, command-line, stdio.
>
>main.c
>======
>#include <stdio.h>
>
>int main(int argc, const char * argv[]) {
> char answer_buffer[512];
> printf("So tell me your name. ");
> scanf("%s", answer_buffer);
> printf("Congratulations, %s, on this tremendous achievement.\n",
> answer_buffer);
>
> return 0;
>}
>======
>
>I ran it (cmd-R) with the Run scheme set to the Debug configuration. I
>entered my name in the debugger console. It worked as expected. I set the
>Run scheme to use Release and tried again. Again, it worked as expected.
>
>I tried a looped getchar() for input (such as for an active terminal
>menu). It wouldn¹t recognize end-of-file unless it was at the start of a
>line, but that¹s to be expected with a buffered terminal. Again, it
>worked as expected in both configurations.
>
>Do you see it with this minimal an example? Have you done anything funny
>with the build settings or scheme? Runtime environment in Xcode
>more-or-less equals scheme, so that¹s the first thing I¹d audit.
>
> ‹ F
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden