delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/10/22/13:31:56

From: Barry Rodewald <bsr AT hn DOT pl DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Scanf function
Date: Wed, 22 Oct 1997 22:21:35 +1300
Lines: 13
Message-ID: <344DC59F.477F@hn.pl.net>
References: <62fp85$nq4$1 AT power DOT ci DOT uv DOT es>
NNTP-Posting-Host: bsr.hn.planet.gen.nz
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Marsel wrote:
> Why the secong scanf function does not wait until the caracter is introduced
> ?. the c variable always contain the caracter \010

Character 10 is a line feed.  scanf accepts input until a carriage
return is recieved (pushing Enter).  When you push Enter, a carriage
return and a line feed is sent.  I would say that this is where the
character 10 is coming from.  To fix it, try putting a '\n' at the end
of the format string (first parameter) in your scanf functions.  Failing
that, look at the example in the DJGPP documentation (under libc.a).

Hope this helps,
Barry Rodewald.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019