How Do I Do something like echo off

This is a discussion on How Do I Do something like echo off within the C++ Programming forums, part of the General Programming Boards category; well I'm using DevC++ Compiler but I'm not working on a windows program I'm working on something that looks like ...

  1. #1
    Registered User
    Join Date
    Oct 2001
    Posts
    75

    How Do I Do something like echo off

    well I'm using DevC++ Compiler but I'm not working on a windows program I'm working on something that looks like dos
    I think u guys call it console anyway I was wonderin gis there anyway you could do like the dos command echo off or something
    to not show what the user has input into cin heres an example


    char name[40];


    cout << "Enter Your Name Here ";
    cin >> name;




    but I dont want to see what the user has put for there name is it possible to do this


    any help would be apreciated

    cheers stealth

  2. #2
    aurė entuluva! mithrandir's Avatar
    Join Date
    Aug 2001
    Posts
    1,209
    Simple - don't cout << the variable that the user enters. You can call the variable at any stage of the program.

    Example:

    Code:
    #include <iostream.h>
    
    int main()
    {
             char name[40];
    
             cout << "Enter your name: ";
             cin >> username;
    
            //Program code etc....
    
            cout << "Thanks "<< username << "!" << endl;
    
            return 0;
    }

  3. #3
    Registered User
    Join Date
    Oct 2001
    Posts
    75

    oh

    yeah thanks man


    the only thing is I dont cout the input


    I got no idea on how to do this I might have to try and work it out though


    oh yeah I still need to know how to change my name I dunno I tryed edit profile so mayb eu can mail me



    cheers


    stealth

  4. #4
    aurė entuluva! mithrandir's Avatar
    Join Date
    Aug 2001
    Posts
    1,209
    >>oh yeah I still need to know how to change my name I dunno I tryed edit profile so mayb eu can mail me

    I think once you've registered a name, you can't edit the name - you have to create a new account. Try sending a PM to the webmaster or kermi3.

  5. #5
    zen
    zen is offline
    of Zen Hall zen's Avatar
    Join Date
    Aug 2001
    Posts
    1,007
    If you don't want to have the input echo'ed on the screen you'll have to use something like getch() and get one character at a time.

    On Dev C++ there are two getch()'s, you want to use the one in conio_mingw.h.
    zen

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Directories and files using dirent.h
    By totalnewbie in forum C Programming
    Replies: 6
    Last Post: 11-19-2008, 04:10 PM
  2. Batch file programming
    By year2038bug in forum Tech Board
    Replies: 10
    Last Post: 09-05-2005, 03:30 PM
  3. A breakthrough
    By loopy in forum Linux Programming
    Replies: 4
    Last Post: 11-26-2003, 05:46 PM
  4. C-Shell Scripting.. Help!
    By denizengt in forum Tech Board
    Replies: 3
    Last Post: 10-29-2003, 12:37 PM
  5. echo command
    By Billing in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 08-31-2001, 08:38 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21