• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: input from console window in Xcode
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: input from console window in Xcode


  • Subject: Re: input from console window in Xcode
  • From: Fritz Anderson <email@hidden>
  • Date: Tue, 22 Jul 2014 15:37:19 -0500

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


References: 
 >input from console window in Xcode (From: "McLaughlin, Michael P." <email@hidden>)

  • Prev by Date: input from console window in Xcode
  • Next by Date: How to enumerate by code points in Swift beta4?
  • Previous by thread: input from console window in Xcode
  • Next by thread: How to enumerate by code points in Swift beta4?
  • Index(es):
    • Date
    • Thread