From: SourceForge.net <no...@so...> - 2010-06-30 20:19:16
|
Plugin Bugs item #3023385, was opened at 2010-06-30 09:26 Message generated for change (Comment added) made by kog13 You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=565475&aid=3023385&group_id=588 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None >Status: Closed Resolution: None Priority: 5 Private: No Submitted By: Damien (kog13) Assigned to: Nobody/Anonymous (nobody) Summary: Console waits on standard input (C only) Initial Comment: I have a basic C program like this: #include <stdio.h> int main() { char name[20]; printf("name: "); fgets(name, 20, stdin); printf("hello, %s\n", name); return 0; } When this program is run in the console's system shell, no output is displayed until some input is given. So it first appears as if the program is doing nothing, but after typing something in and hitting enter, the rest of the program runs, displaying prompts for input only after the input is already given. >From what I've noticed, java and c++ programs don't have the same problem. It's only when I compile and try to run a straight C program that it does this. ---------------------------------------------------------------------- >Comment By: Damien (kog13) Date: 2010-06-30 15:19 Message: Never mind, this isn't an issue with console, but with C itself. It won't flush the output until the buffer fills or the process terminates. If I can find a way to force C to hand over its input immediately, I'll make a patch for it, but this doesn't count as a bug. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=565475&aid=3023385&group_id=588 |