Thread: hide character when typing

  1. #1
    Registered User
    Join Date
    May 2008
    Posts
    134

    hide character when typing

    How to implement it using pure c.. no C++?
    thanks in advance.

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    You need to use whatever your environment provides you. If you're in a console of some kind, you probably want a library such as ncurses. If you're doing Windows programming, they probably have something similar. Anyway, it's entirely dependent on your environment / compiler, and not something that's standard in C.

    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    Registered User
    Join Date
    May 2008
    Posts
    134
    am on linux. I want it to have in its simplest way!

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    type 'man termios' at the command prompt, and read about ECHO.
    There is an example use of termios in one of the FAQs.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  5. #5
    Registered User
    Join Date
    May 2008
    Posts
    134
    thanks salem but I am unable to understand how it is working?
    A pointer to explanation of the code(how and why it is working to make myself comfortable with such techniques) will also be highly appreciated.

  6. #6
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    There's an example in the FAQ.

    If you get bored of manual searching, try "termios" in the search field.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  7. #7
    Registered User
    Join Date
    May 2008
    Posts
    134
    yeah, I did that only!

    what is this line of code doing?

    newt.c_lflag &= ~( ICANON | ECHO );

  8. #8
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Have a guess...

    Or read what &, ~ and | do.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Using a character array in a switch question.
    By bajanElf in forum C Programming
    Replies: 10
    Last Post: 11-08-2008, 08:06 AM
  2. <string> to LPCSTR? Also, character encoding: UNICODE vs ?
    By Kurisu33 in forum C++ Programming
    Replies: 7
    Last Post: 10-09-2006, 12:48 AM
  3. LoadFromFile() from a txt
    By Snoopy104 in forum C++ Programming
    Replies: 6
    Last Post: 03-14-2006, 10:05 AM
  4. Any help would be appreciated.....
    By SprinterSteve in forum C Programming
    Replies: 6
    Last Post: 05-01-2003, 09:25 AM
  5. Hide or Mask Typing
    By Jperensky in forum C++ Programming
    Replies: 2
    Last Post: 04-12-2002, 12:10 PM