Thread: Accepting a Variable in C without getting it displayed

  1. #1
    Registered User
    Join Date
    Jan 2009
    Posts
    1

    Lightbulb Accepting a Variable in C without getting it displayed

    In general C language, scanf and gets syntax is used to accept variables of both integer & character type from user,but the value of the variable displays on the screen,while the user types the value.Say,if we have to accept a password from user then,we can't let it displayed on screen,and allow to everyone see the password.So,Is there any syntax available in C that accepts variable of type integer or character without getting it displayed???

  2. #2
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by Diwaker View Post
    In general C language, scanf and gets syntax is used to accept variables of both integer & character type from user,but the value of the variable displays on the screen,while the user types the value.Say,if we have to accept a password from user then,we can't let it displayed on screen,and allow to everyone see the password.So,Is there any syntax available in C that accepts variable of type integer or character without getting it displayed???
    Depends on the platform (i.e. it isn't portable). You need to disable echoing in the terminal.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  3. #3
    Registered User ch4's Avatar
    Join Date
    Jan 2007
    Posts
    154
    In my opinion try a search to the current forum.
    Keyword "password" you will find everything you need.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. variable being reset
    By FoodDude in forum C++ Programming
    Replies: 1
    Last Post: 09-15-2005, 12:30 PM
  2. float/double variable storage and precision
    By cjschw in forum C++ Programming
    Replies: 4
    Last Post: 07-28-2003, 06:23 PM
  3. Beginner question
    By Tride in forum C Programming
    Replies: 30
    Last Post: 05-24-2003, 08:36 AM
  4. static variable
    By Roaring_Tiger in forum C Programming
    Replies: 9
    Last Post: 04-01-2003, 01:12 PM
  5. Variable question I can't find answer to
    By joelmon in forum C++ Programming
    Replies: 3
    Last Post: 02-12-2002, 04:11 AM