Invisible Keystrokes

This is a discussion on Invisible Keystrokes within the C++ Programming forums, part of the General Programming Boards category; I am new to C++ and was wondering how you input, without what your typing being displayed on the screen, ...

  1. #1
    Registered User
    Join Date
    Aug 2002
    Posts
    11

    Cool Invisible Keystrokes

    I am new to C++ and was wondering how you input, without what your typing being displayed on the screen, if this is already on the board I apologize, i couldn't find it.

    I am using visual C++ 6.0
    Example:
    when using the "cin" command out of the iostream header;
    what you are typing is displayed as you type it, I would like to use
    this for inputting passwords.

    thanks alot

    p.s great site, excellent source for great links, and code;

  2. #2
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    You need a non-standard function to do that. It involves getting unbuffered keyboard input.

    If you have it, you could use getch() (conio.h if you're using Windows).
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  3. #3
    Registered User
    Join Date
    Jul 2002
    Posts
    94
    Code:
    #include <stdio.h>
    #include <conio.h> // getch()
    
    int main()
    {
    	int input;
    	printf("Enter a number: ");
    	while ((input = getch()) != '\r')
    		putchar(' ');
    	return 0;
    }
    You could of course make function that does that work for you.

    Brendan
    Draco dormiens nunquam titillandus

  4. #4
    Registered User
    Join Date
    Aug 2002
    Posts
    11

    Talking Thanks

    Thanks!!!

  5. #5
    Registered User
    Join Date
    Aug 2002
    Posts
    11

    Talking Thanks

    Thanks!!!

  6. #6
    Registered User
    Join Date
    Jul 2002
    Posts
    94
    Lol your welcome...your welcome!

    Brendan
    Draco dormiens nunquam titillandus

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Fake keystrokes to another process
    By Nota in forum Windows Programming
    Replies: 20
    Last Post: 01-26-2009, 10:56 PM
  2. Sending keystrokes to another view
    By azeemanwer in forum C++ Programming
    Replies: 2
    Last Post: 08-28-2007, 10:41 AM
  3. Send keystrokes to a running program via batch file
    By ganjamon in forum Windows Programming
    Replies: 2
    Last Post: 08-16-2005, 08:08 AM
  4. Tracking number of keystrokes
    By thecow in forum Windows Programming
    Replies: 4
    Last Post: 06-04-2003, 03:23 PM

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