delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/03/01/15:30:58

From: "Brian" <schousek AT geocities DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: why don't this work
Date: Sun, 1 Mar 1998 15:02:12 -0500
Organization: NetUSA1 Inc.
Lines: 34
Message-ID: <6dceuf$mas$1@news.netusa1.net>
References: <34F79C17 DOT 71DC AT sainet DOT net>
NNTP-Posting-Host: indyk83.netusa1.net
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

shifter wrote in message <34F79C17 DOT 71DC AT sainet DOT net>...
>#include <stdio.h>
>
>main()
>{
>char *i;
>char *password;
>
>   clrscr();
>   printf ("Input a password:");
>   gets(password);
>   printf("you typed:%s\n",password);
>   do{
>   printf ("Input a password:%s:",i);



>   }while (gets(i) != password);

the function gets returns address of i, not the string i. I'm not really up
on my strings either, but perhaps
while(strcmp(gets(i),password) !=0)
would work instead.

>   printf("you got it!!!");
>   exit(0);
>}
>
>i'm trying to get it to break out of loop with the correct password
>what am i doing wrong?
>ralph <shifter AT sainet DOT net>


- Raw text -


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