From: Joe Wright Newsgroups: comp.os.msdos.djgpp Subject: scanf() Date: Sat, 30 Nov 1996 16:02:06 -0500 Organization: Alpha Solutions Lines: 23 Message-ID: <32A0A0CE.622C@exis.net> Reply-To: wrightj AT exis DOT net NNTP-Posting-Host: ppp-1-1.exis.net Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp I think this is a djgpp question rather than a comp.lang.c one. Maybe not, but.. I have only one C compiler and its DJ's 2.0. The stdio scanf() is giving me a fit. First, if I only press when it is waiting for input, it hangs the system. Only ^C gets me out with a SIGINT to the DOS prompt. Is that 'defined' behavior? This next one drove me crazy for an hour.. double d = 6998.82; ..... printf("Amount = "); scanf("%f", &d); I type what I like, scan() executes but d doesn't change. After pulling some already sparse hair looking for bugs, I try compiling it with -Wall and guess what. gcc says "%f" is float and d is double. I know that! When I declare 'float d;', scanf() does as expected. Now I know that "%f" in a printf() string is promoted to double. Is this not the case for scanf()? I'm getting really tired of scanf(). Joe