-
Notifications
You must be signed in to change notification settings - Fork 0
Functions
This page explains roughly how the functions works.
inputstr()
Definition:
char *inputstr(char *askStr, int strSize, char *lengthError, int acceptNull, char *nullError);Get a string (char *) input from the user.
Return value: A char pointer. free() this return value.
askStr: A string used to prompt the user. Can be "" if you don't want to use it.
strSize: An int to set the max size of the input. (If 0, default to 1024)
lengthError: A string used to tell the user length of the input is invalid. (If "", it will default to : "The length of the input is invalid.")
acceptNull: A boolean (0 or 1) used to accept a empty input as a valid input. (0 = accept empty string, 1 = error if the string is empty, if neither 0 or 1, it will default to 0)
nullError: A string used to inform the user that the input is invalid if acceptNull = 1 and the input is empty. (If "", it will default to "The input is invalid.")
inputchar()
Definition:
char inputchar(char *askStr)Get a char input from the user.
Return value: A char.
askStr: A string used to prompt the user. Can be "" if you don't want to use it.
inputint()
Definition:
int inputint(char *askStr, int intSize, char *lengthError, int acceptNull, char *nullError);Get an int input from the user.
Return value: An int.
askStr: A string used to prompt the user. Can be "" if you don't want to use it.
intSize: An int to set the max size of the input. (If 0 or > 9, default to 9)
lengthError: A string used to tell the user length of the input is invalid. (If "", it will default to : "The length of the input is invalid.")
acceptNull: A boolean (0 or 1) used to accept a empty input as a valid input. (0 = accept empty string, 1 = error if the string is empty, if neither 0 or 1, it will default to 0)
nullError: A string used to inform the user that the input is invalid if acceptNull = 1 and the input is empty. (If "", it will default to "The input is invalid.")
inputdbl()
Definition:
double inputdbl(char *askStr, int dblSize, char *lengthError, int acceptNull, char *nullError);Get a double input from the user.
Return value: A double.
askStr: A string used to prompt the user. Can be "" if you don't want to use it.
dblSize: An int to set the max size of the input. (If 0 or > 9, default to 9)
lengthError: A string used to tell the user length of the input is invalid. (If "", it will default to : "The length of the input is invalid.")
acceptNull: A boolean (0 or 1) used to accept a empty input as a valid input. (0 = accept empty string, 1 = error if the string is empty, if neither 0 or 1, it will default to 0)
nullError: A string used to inform the user that the input is invalid if acceptNull = 1 and the input is empty. (If "", it will default to "The input is invalid.")
inputfloat()
Definition:
float inputfloat(char *askStr, int floatSize, char *lengthError, int acceptNull, char *nullError);Get a float input from the user.
Return value: A float.
askStr: A string used to prompt the user. Can be "" if you don't want to use it.
floatSize: An int to set the max size of the input. (If 0 or > 9, default to 9)
lengthError: A string used to tell the user length of the input is invalid. (If "", it will default to : "The length of the input is invalid.")
acceptNull: A boolean (0 or 1) used to accept a empty input as a valid input. (0 = accept empty string, 1 = error if the string is empty, if neither 0 or 1, it will default to 0)
nullError: A string used to inform the user that the input is invalid if acceptNull = 1 and the input is empty. (If "", it will default to "The input is invalid.")
inputlong()
Definition:
long inputlong(char *askStr, int longSize, char *lengthError, int acceptNull, char *nullError);Get a long input from the user.
Return value: A long.
askStr: A string used to prompt the user. Can be "" if you don't want to use it.
longSize: An int to set the max size of the input. (If 0 or > 9, default to 9)
lengthError: A string used to tell the user length of the input is invalid. (If "", it will default to : "The length of the input is invalid.")
acceptNull: A boolean (0 or 1) used to accept a empty input as a valid input. (0 = accept empty string, 1 = error if the string is empty, if neither 0 or 1, it will default to 0)
nullError: A string used to inform the user that the input is invalid if acceptNull = 1 and the input is empty. (If "", it will default to "The input is invalid.")
cleanstr()
Definition:
char *cleanstr(char *strToClean);Clean a string by removing \r and \n at the end of the string.
Return value: A char pointer.
strToClean: The string that will be cleaned.
lowerstr()
Definition:
char *lowerstr(char *str);Convert upper-case string to lower-case string.
Return value: A char pointer.
str: The string that will be converted.
upperstr()
Definition:
char *upperstr(char *str);Convert lower-case string to upper-case string.
Return value: A char pointer.
str: The string that will be converted.
lowerchar()
Definition:
char lowerchar(char character);Convert upper-case char to lower-case char.
Return value: A char.
character: The character that will be converted.
upperchar()
Definition:
char upperchar(char character);Convert lower-case char to upper-case char.
Return value: A char.
character: The character that will be converted.
Definition:
void clearstdin(void);Clear stdin.
Definition:
void intobinary(unsigned int nbr, unsigned int length);Convert an int into binary and prints it.
nbr: An int to convert to binary.
length: The max length of the binary number that will be printed. (If > 30, it will default to 30)