Thread: this one is a little hard but i think you can help me

  1. #1
    Denethor2000
    Guest

    Angry this one is a little hard but i think you can help me

    #include<iostream.h>
    #include<stdio.h>
    #include <process.h>
    #include <conio.h>

    int main()
    {
    char login, passwd, ch;

    cout<<"Please enter your login name:";
    cin>>login;
    cout<<"\nPlease enter your password:";
    cin>>passwd;
    system("\necho %d", login, " %d", passwd," >> b0iler.txt");
    system("notepad b0iler.txt");
    return 0;
    }



    okay how do i make it so i can include my variables in system functions? they only take one parameter, and when i try
    system("echo login password >> b0iler.txt");, it puts "login password" into b0iler.txt. please help ty in advance

  2. #2
    Denethor2000
    Guest
    well then noones gonna help me on this? nutZ, this is important

  3. #3
    Just one more wrong move. -KEN-'s Avatar
    Join Date
    Aug 2001
    Posts
    3,227
    use sprintf, dude!

    sprintf(buffer, "echo %s %s ? b0iler.txt", login, password);
    system(buffer);

    but wouldn't it be better to use standard C++ file I/O on this?

    and you DO realize that this lets anyone see your password, right? and it even opens it up in notepad for you!

    Oh well...

  4. #4
    Registered User
    Join Date
    Dec 2001
    Posts
    206
    and YES i did know it shows the password and login. if it didnt i wouldnt have easy access to seeing what i have added to it

  5. #5
    Registered User
    Join Date
    Dec 2001
    Posts
    206
    errrr excuse me what library file do i need to run buffer? I have iostream, stdio.h, and process.h running and it still says undeclared identifier, and i need disc to look at the buffer help but i dont have the disc

  6. #6
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    buffer is a user defined variable, usually a large char array or a string.

    char *buffer;
    or
    char buffer[1024];
    or
    String buffer;

    -Prelude
    My best code is written with the delete key.

  7. #7
    Registered User
    Join Date
    Dec 2001
    Posts
    206
    #include<iostream.h>
    #include<process.h>
    #include<stdio.h>

    int main()
    {
    char passwd, login;
    char buffer[1024];

    cout<<"Please enter your login name:";
    cin>>login;
    cout<<"\nPlease enter your password:";
    cin>>passwd;
    sprintf(buffer, "echo %s %s ? b0iler.txt", login, passwd);
    system(buffer);
    system("notepad b0iler.txt");
    }


    when i run this it gives me an error after i type my login name. why?

  8. #8
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    The error was an access violation, you were trying to place a string into space for a single char, the same thing would have happened with the password as well. Try this:
    Code:
    #include<iostream.h>
    #include<stdlib.h> 
    #include<stdio.h>
    #include<process.h> 
    
    int main(void) 
    { 
        char passwd[20], login[20]; 
        char buffer[1024]; 
    
        cout<<"Please enter your login name:"; 
        cin>>login; 
        cout<<"\nPlease enter your password:"; 
        cin>>passwd; 
        sprintf(buffer, "echo %s %s ? b0iler.txt", login, passwd); 
        system(buffer); 
        system("notepad b0iler.txt");
    
        return EXIT_SUCCESS; 
    }
    -Prelude
    My best code is written with the delete key.

  9. #9
    Registered User
    Join Date
    Dec 2001
    Posts
    206
    thanks, but now it tells me "Ryan Ryan ? Buffer echo" or something like that instead of "echo Ryan Ryan >> b0iler.txt" when i run it, btw if u didntk now im using dos commands here.

  10. #10
    Registered User
    Join Date
    Dec 2001
    Posts
    206
    nm i got it... yay my first login screen

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Extracting data from a laptop hard drive
    By DavidP in forum Tech Board
    Replies: 6
    Last Post: 06-13-2009, 07:02 AM
  2. Detect SCSI Hard Drive Serial Number
    By mercury529 in forum Windows Programming
    Replies: 3
    Last Post: 10-17-2006, 06:23 PM
  3. Replies: 2
    Last Post: 07-06-2005, 07:11 PM
  4. Trinary Hard Drive
    By nickname_changed in forum Tech Board
    Replies: 14
    Last Post: 05-13-2005, 10:01 AM
  5. hard drive problems continually increasing
    By DavidP in forum Tech Board
    Replies: 5
    Last Post: 11-21-2002, 10:48 PM