Library that uses heap to simplify user input in C.
This is a C library, inspired by libcs50, that simplifies the process of getting user input. It provides a convenient way to display a message, read user input, filter it and return it if valid. If the input is invalid, the library repeats the process until valid input is received.
The main goal is to understand memory management with the heap as it is built, and to provide a higher level abstraction for handling user input. Contributions and suggestions are welcome to further improve and extend the functionality.
- Clone the repository.
- Link the path when you want execute your program.
#include "input.h"
// The syntax is similar to <type> input = get_<type>("message");
// And type can be char, string (char *), double, float, integer and long
...
// Normal
char name = get_char("Message");
// Format
char name = get_char("%s", message);
// String case
char *name = get_string("Message");
char *name = get_string("%s", message);
...
Improvements?
- Don't hesitate to create a PR.
Problems?
- Feel free to open a new issue!