hide character when typing

This is a discussion on hide character when typing within the C Programming forums, part of the General Programming Boards category; How to implement it using pure c.. no C++? thanks in advance....

  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 wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,558
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  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 wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,558
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  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 wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,558
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

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, 07: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, 09: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

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