Reputation: 24140
I am using function getopt_long
to get command line options.
I want to ignore error when a invalid option is given.
Currently it printing error to stderr like:
invalid option -- 's'
Upvotes: 2
Views: 3793
Reputation: 121387
There's variable opterr
in unistd.h
which will avoid printing the the error to stderr
if you set it to 0.
Just set it to 0:
#include <unistd.h>
opterr = 0;
Upvotes: 5