Close Back

#define OUTCHAR '*'

#include<stdio.h>
#include<dos.h>
#include<conio.h>
#include<math.h>
#include<string.h>
#include<ctype.h>
#include<graphics.h>
#include<stdlib.h>

char *getpassrajesh(char *);
char *getpassstar(char *);

main()
{
	typedef char *charptr;
	charptr p;
	int x;
	clrscr();
	printf("\nA call to getpass() Library function\n");
	p=getpass("PASSWORD : ");
	printf("\nyour password is \"%s\"",p);
	getch();
	clrscr();
	printf("\nA call to getpassrajesh() the function i wrote\n");
	p=getpassrajesh("PASSWORD : ");
	printf("\nyour password is \"%s\"",p);
	getch();
	clrscr();
	printf("\nA call to getpassstar() the function i wrote\n");
	p=getpassstar("PASSWORD : ");
	printf("\nyour password is \"%s\"",p);
	getch();
	clrscr();
	highvideo();
	printf("\n\t");
	cprintf("Advantages\n");
	for(x=0;x<80;x++)
		putch('\b');
	printf("\t");
	cprintf("~~~~~~~~~~");
	printf("\n\t\4\tAny number of charecters allowed");
	printf("\n\t\4\tIt\'s source is available ! ");
	printf("\n\t\4\tMasking feature available");
	printf("\n\n\n\t\t\t-Author : ");
	cprintf("Rajesh _ThE gReAt");
	normvideo();
	getch();
}
char *getpassrajesh(char *write)
{
	char ch;
	char *pass;
	char *work;
	work=pass;
	putc('\n',stdout);
	while(*write)
		putchar(*(write++));
	do
	{
		ch = getch();
		*(pass++)=ch;
	}
	while(ch != '\r');
	*(--pass)=0;		/*Replace '\r' by NULL charecter*/
	return(work);
}

char *getpassstar(char *write)
{
	char ch;
	char *pass;
	char *work;
	work=pass;
	putc('\n',stdout);
	while(*write)
		putchar(*(write++));
	do
	{
		ch = getch();
		*(pass++)=ch;
		if(ch!='\r')
			putc(OUTCHAR,stdout);
	}
	while(ch != '\r');
	*(--pass)=0;		/*Replace '\r' by NULL charecter*/
	return(work);
}