delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/07/18/23:47:29

From: James MacDonald <trill AT Xnetbook DOT demon DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Help with scanf()
Date: Fri, 18 Jul 1997 21:10:20 +0100
Organization: Trills and Technologies
Distribution: world
Message-ID: <4GFM1XAs28zzEwrp@netbook.demon.co.uk>
NNTP-Posting-Host: netbook.demon.co.uk
MIME-Version: 1.0
Lines: 22
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

At the moment I'm using scanf() - I need to read a value from the
keyboard and compare it with a generated one made by a program.

Here's the code :

char * enter;

scanf("%s", enter);
printf("Entered string : %s", enter);
if (enter == chalcrypt) printf("it worked!");

For entered string, '(null)' is displayed, and that only.
What am I doing wrong?

Is there an easier way to read the keyboard?
I've tried gets() but I've got stuck there too :(
-- 
Revised anti-spam in use : remove X to reply - 
'Xnetbook' becomes 'netbook'

Anti-spam thermonuclear warheads cheap at only $300!

- Raw text -


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