Jump to content

code: to replace password with "*"

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
14 replies to this topic

#1
solartic

solartic

    Learning Programmer

  • Members
  • PipPipPip
  • 95 posts
This code will show you how to hide input character from the keyboard and display a "*" in its space.
if you have any questions please ask
commented and non-commented file.
P.S sorry for the crappy comments:o

Attached Files



#2
v0id

v0id

    Retired

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,936 posts
Unfortunately, getch() isn't a standard C function. It's a borland-thing, and should therefore, IMO, not be used - but it's probably great if you're a borland-user, and want to use this. Also, I would not call this a tutorial, as it's only some code. If you explained the code and what it was doing, it would be more tutorial-alike.

#3
solartic

solartic

    Learning Programmer

  • Members
  • PipPipPip
  • 95 posts
hey thanks for the reply. your right its not a tutorial sorry for the mixup i though u could put either raw code or tuts here,the tut on the file name was just a mistake. I use devc++ most windows compiler i guess have getch(). I wanted to make something that could work on bouth windows and Linux but im not that skilled as yet. i really cant think of a standard way of doing this that would be some major coding.

#4
morfec

morfec

    Newbie

  • Members
  • Pip
  • 7 posts
thanks thanks thanks

#5
Xav

Xav

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 13,118 posts
Why are you posting that everywhere?
Jordan said:

Good members, like yourself, stick around and post for ages to come!
Mr. Xav | Blog | Forums

#6
morfec

morfec

    Newbie

  • Members
  • Pip
  • 7 posts
sorry for that but when i like something i have to say thanks and i think it is enough that is all

#7
Xav

Xav

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 13,118 posts
Ok.
Jordan said:

Good members, like yourself, stick around and post for ages to come!
Mr. Xav | Blog | Forums

#8
luverboy4u

luverboy4u

    Newbie

  • Members
  • Pip
  • 4 posts
i'm newbie can this be done in c-sharp

#9
Xav

Xav

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 13,118 posts
Of course! C# is not too different from C++. Which IDE are you using? VS2008/2005?
Jordan said:

Good members, like yourself, stick around and post for ages to come!
Mr. Xav | Blog | Forums

#10
marwex89

marwex89

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 10,720 posts
I checked it out : Nice :D
Hey! Check out my new Toyota keyboaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

#11
Xav

Xav

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 13,118 posts
It's worth noting, though, that in .NET text boxes can be set to proper password fields, with those big dots. A prompt pops up for the Caps lock being pressed on, etc. It's a property of the Windows.Forms.TextBox.
Jordan said:

Good members, like yourself, stick around and post for ages to come!
Mr. Xav | Blog | Forums

#12
outsid3r

outsid3r

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 623 posts
I have a new sugestion:

#include <stdio.h>
#include <conio.h>

#define KEY_SPACE 13
#define PASS_SIZE 20

int main()
{
	char pass[PASS_SIZE];
	register int i = 0;
	
	while ((pass[i++] = getch()) != KEY_SPACE && i<PASS_SIZE ) putchar('*');

	return 0;
}

Just do the same as your function, but with less lines of code and with a different methot. Thats just a suggestion.