Why do I get a segmentation fault when I send the flags -h or -H.
bool parse_command(int argc, char **argv, bool *header, char **fileName)
{
if (!argv)
return false;
bool *flagh = false;
bool *flagH = false;
char *options = "Hh";
int opt = 0;
while ( (opt = getopt(argc, argv, options ) ) != -1)
{
printf("HELLO");
switch (opt)
{
case 'h':
*flagh = true;
break;
case 'H':
*flagH = true;
break;
default:
usage_p1();
return false;
}
}
printf("%d", opt);
// Implement this function
return true;
}