Re: i need help about Turbo C
- From: Keith Thompson <kst-u@xxxxxxx>
- Date: Mon, 17 Jul 2006 21:14:37 GMT
"Tom St Denis" <tomstdenis@xxxxxxxxx> writes:
pipito wrote:[...]
Hi...i am a beginner in C programming...
my question is like this...
im using the scanf in C to accept input data in output area,
printf("name: ");scanf("%s",name);
You need to add a "\n" or the printf won't always show. The stream is
only guaranteed to flush if you send a newline.
Another approach is to use fflush:
printf("name: ");
fflush(stdout);
fgets(name, sizeof name, stdin);
This isn't absolutely guaranteed to work, but it should work on any
system where this kind of interactive prompting makes sense.
--
Keith Thompson (The_Other_Keith) kst-u@xxxxxxx <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
.
- References:
- i need help about Turbo C
- From: pipito
- Re: i need help about Turbo C
- From: Tom St Denis
- i need help about Turbo C
- Prev by Date: Re: i need help about Turbo C
- Next by Date: Re: Largest Palindrome
- Previous by thread: Re: i need help about Turbo C
- Next by thread: Re: i need help about Turbo C
- Index(es):
Relevant Pages
|