Structure Query Language, C programming, Java, Servlet, Jsp, Unix

Tuesday 3 July 2012

API for Password, Numeric Key, Alphabats


Header File : Master.h
Web         : www.master-gtu.blogspot.com

This header file include Standard function like getting only numeric values or getting only alphabats and
taking a password from user(showing * while inputing)

1. getPassword()

 SYNTAX :
void getPassword(char variable[])
void getPassword(char variable[], int min_size)
void getPassword(char variable[], int min_size, char prompt)
void getPassword(char variable[], int min_size, int max_size)
void getPassword(char variable[], int min_size, int max_size, char prompt)

 INFO : This function is usefull for taking a password from user(showing him a * at a time of input).
it will take a character array on which password is saved.
user can also set prompt instead of default prompt that is *.
user also set min and maximum limit.
user can enter password that contain any of the following
alphabats(capital or small)
numbers
special symbols @[at the rate] *[astrik or star] .[period] only 

 EXAMPLE :
#include<master.h>
void main()
{
 char pass[50];
 printf("Enter Password : ");
 getPassword(pass,8,'@');
 printf("Your Password is %s",pass);
}

2. getNumber()

 SYNTAX :
int getNumber()

 INFO : This function is usefull for taking only numeric value from user(user can't even press other symbols). It will return a integer type value that contains only numbers. We can use this function for taking marks, age, date, month, year etc from user.

 EXAMPLE :
#include<master.h>
void main()
{
 int marks=0;
 printf("\nEnter Marks : ");
 marks=getNumber();
 printf("\n\nYour Marks is %d",marks);
}

3. getAlpha()

 SYNTAX :
getAlpha(char str[])

 INFO : This function is usefull for taking only alphabatic value from user(user can't even press other symbols). It will take a character array as an argument which is used for return value. We can use this function for taking names because name can't contain any numbers or any other symbols.

 EXAMPLE :
#include<master.h>
void main()
{
 char name[50];
 printf("\nEnter Names");
 getAlpha(name);
 printf("\n\nYour Name is %s",name);
}

Download Header File From Here                     

1 comment:

  1. this code is awesome, it would be great if there was getChar and getDouble validation too. i need it badly, but i have no time now :(

    ReplyDelete