ecah-lib (easier cpp argument handler library)
is a header-only library to easily handle arguments in C++ (!)
to use ecah-lib you need to download the library's .h (header) file and #include
it in your C++ project
if the header file is in the same directory as your .cpp file #include "ecah-lib.h"
here's an example program, for more (and more practical) example programs, check out the ./examples directory in this repo;
#include "ecah-lib.h" // Including ecah-lib in our project
using namespace eca; // Optionally use the `eca` namespace (Basically if you do not want to use the `eca::` prefix on ecah-lib's methods/functions)
int main(int argc, char* argv[]) // argc = count of command-line arguments, argv = array of command-line argument strings
{
string firstArgument; // Create an empty string
arg.store(firstArgument, 1, argc, argv); // Store the first argument in the string `programName` (index 1 in the argv array)
cout << "The first argument is: " << firstArgument << "\n"; // Prints the first argument
return 0; // Returns 0 (Basically quits the program)
}
/*
Compiled with g++ on Arch Linux, output;
$ g++ -o test main.cpp
$ ./test Hello!
The first argument is: Hello!
*/