Thread: Comparison not working

  1. #1
    Registered User rbrt13's Avatar
    Join Date
    Oct 2009
    Location
    Holly, Michigan
    Posts
    2

    Comparison not working

    Hello everyone, I am currently in the beginning stages of writing a C IRC bot, and I wanted to integrate something so that there would be a password that had to be provided in order to start it. I have started a way to either specify the password as an argument or by starting the bot normally, however neither are working. Also if I simply open the executable in a text editor, the password is perfectly readable inside of it. Is there any way to obscure the password in the executable and make if so that it actually works? Thanks.

    Code:
    int main(int argc, char *argv[]) {
      if ( argc > 1 ) {
        if ( argv[1] != password ) {
             puts ( "Password incorrect" );
             pause();
             exit ( 1 );
          }
        }
      else {
        printf ( "Please enter a password: " );
        scanf ( "%256%s", input );
        if ( &input != password ) {
          printf ( "Password incorrect\n" );
          pause();
          exit ( 1 ); } }
      puts ( "Password accepted" );
      pause();
      return 0; }

  2. #2
    Registered User rbrt13's Avatar
    Join Date
    Oct 2009
    Location
    Holly, Michigan
    Posts
    2
    Sorry, looked around the forum a little more and found the answer.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. my comparison isn't working
    By Rubiks14 in forum C++ Programming
    Replies: 3
    Last Post: 10-02-2005, 07:50 PM
  2. Program Not working Right
    By raven420smoke in forum C++ Programming
    Replies: 2
    Last Post: 09-16-2005, 03:21 AM
  3. Trying to eject D drive using code, but not working... :(
    By snowfrog in forum C++ Programming
    Replies: 3
    Last Post: 05-07-2005, 07:47 PM
  4. x on upper right corner not working
    By caduardo21 in forum Windows Programming
    Replies: 1
    Last Post: 02-20-2005, 08:35 PM
  5. cygwin -> unix , my code not working properly ;(
    By CyC|OpS in forum C Programming
    Replies: 4
    Last Post: 05-18-2002, 04:08 AM