Skip to content

ecah-lib is a header-only library to easily handle arguments in C++ (!)

License

Notifications You must be signed in to change notification settings

jstmaxlol/ecah-lib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ecah-lib 💊

ecah-lib (easier cpp argument handler library)
is a header-only library to easily handle arguments in C++ (!)

how to use ⁉️

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!
*/

 

jstmax@62-69-74-2E-6C-79-2F-6D-78-5F-69-6E-66-6F

About

ecah-lib is a header-only library to easily handle arguments in C++ (!)

Topics

Resources

License

Stars

Watchers

Forks

Languages