The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
.
google unix.com



High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Hide Password whatisthis Shell Programming and Scripting 4 07-21-2008 09:59 AM
How Do I Hide the Password in a Script samd Shell Programming and Scripting 6 11-22-2006 05:38 AM
Want to hide password arpitk Shell Programming and Scripting 1 09-29-2006 09:42 AM
Hide oracle password on unix process list acheepi Shell Programming and Scripting 3 10-06-2005 10:25 PM
How to hide password on Linux? nir_s Shell Programming and Scripting 2 02-09-2005 12:24 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 09-30-2004
ivancheung ivancheung is offline
Registered User
  
 

Join Date: Sep 2004
Posts: 13
Talking hide password typing

I am doing a project in C program which requires to type in password in Unix terminal. Does anybody know how to shade or not output any words typed by user in the terminal?

I use the function scan() to read typing from user. Thanks in advance.
  #2 (permalink)  
Old 09-30-2004
ivancheung ivancheung is offline
Registered User
  
 

Join Date: Sep 2004
Posts: 13
sorry Driver, i really can't figure out the solution for my question with the code below that you posted. Would you please explain more with a simple code to do that? Thanks.


Code:
#include <termios.h>
#include <stdio.h>

int
getch(void) {
    struct termios old;
    struct termios new;
    int rc;
    if (tcgetattr(0, &old) == -1) {
        return -1;
    }
    new = old;
    new.c_lflag &= ~(ICANON | ECHO);
    new.c_cc[VMIN] = 1;
    new.c_cc[VTIME] = 0;
    if (tcsetattr(0, TCSANOW, &new) == -1) {
        return -1;
    }
    rc = getchar();
    (void) tcsetattr(0, TCSANOW, &old);
    return rc;
}

  #3 (permalink)  
Old 09-30-2004
ivancheung ivancheung is offline
Registered User
  
 

Join Date: Sep 2004
Posts: 13
Driver,

thanks very much for help. I have find the solution. Your code works.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:58 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0