| ftp.delorie.com/archives/browse.cgi | search |
| From: | "Alexei A. Frounze" <dummy_addressee AT hotmail DOT com> |
| Newsgroups: | comp.os.msdos.djgpp |
| Subject: | Re: is this a bug? |
| Date: | Mon, 26 Mar 2001 21:06:41 -0500 |
| Organization: | Global Crossing Telecommunications |
| Lines: | 45 |
| Sender: | UNKNOWN AT 209-130-186-49 DOT nas7 DOT roc DOT gblx DOT net |
| Message-ID: | <99osh3$ike$1@node17.cwnet.frontiernet.net> |
| References: | <99oo0k$gr7$1 AT neptunium DOT btinternet DOT com> |
| NNTP-Posting-Host: | 209-130-186-49.nas7.roc.gblx.net |
| X-Trace: | node17.cwnet.frontiernet.net 985658723 19086 209.130.186.49 (27 Mar 2001 02:05:23 GMT) |
| X-Complaints-To: | abuse AT frontiernet DOT net |
| NNTP-Posting-Date: | 27 Mar 2001 02:05:23 GMT |
| X-Priority: | 3 |
| X-MSMail-Priority: | Normal |
| X-Newsreader: | Microsoft Outlook Express 5.50.4133.2400 |
| X-MimeOLE: | Produced By Microsoft MimeOLE V5.50.4133.2400 |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
| Reply-To: | djgpp AT delorie DOT com |
I'm not sure, but probably you need '\n' in scanf().
Good Luck
--
Alexei A. Frounze
alexfru [AT] chat [DOT] ru
http://alexfru.chat.ru
http://members.xoom.com/alexfru/
http://welcome.to/pmode/
"Michael Ahumibe" <M DOT Ahumibe AT btinternet DOT com> wrote in message
news:99oo0k$gr7$1 AT neptunium DOT btinternet DOT com...
> Hi
>
> The following program should ask for a character to be input near the end
>
> #include <stdio.h>
>
> int main()
> {
> char string[20];
> unsigned int number;
> char test;
>
> printf("Enter a string: ");
> scanf("%s", &string);
>
> printf("Enter a number: ");
> scanf("%u", &number);
>
> printf("Enter a character: ");
> scanf("%c", &test);
>
>
> printf("%s %u %c",string,number,test);
>
> return 0;
> }
>
> I compile the code and run it. The line containing scanf("%c", &test); is
> skipt!! can someone tell me the exact reason for this?
>
>
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |