unistd.h : >>>is a library found in Unix and Linux systems.
it has methods that deals with os most fucused on ( files and processes)
methods:
##>> getopt(int argc,char * argv, optstring):
used to analyse the command line options
example
getopt(argc, argv, "f:v");
the third parameter is where you put the options for your program.
: means there is a value if (there isn't you write it alone like v)
it returns int:
-1 when all options parsed
? unknown option(ivalid character)
: missing required argument(if :used)
options char valid option was found
example
int opt
while ((opt = getopt(argc, argv,"fa")
{
switch(opt)
{
case "a":
case "f":
}
}
variables in getopt:
optarg = pointer to the current option's argument(if any)
optopt = the last known option character that caused an error
optind = index of the next argv[] to be processed