MIPI_BaseC_WebinarFRTK/26_Seminar13/00_case_p3.c
2024-11-13 09:22:28 +03:00

30 lines
808 B
C
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include <stdio.h>
#include <unistd.h>
int main(int argc, char *argv[])
{
int rez=0;
// printf("%d\n",argc);
if(argc==1)
printf("-h help\n");
//opterr=0;Можно отключить вывод сообщений об ошибках, для этого надо где-то в
//программе перед вызовом функции вставить opterr=0
while ( (rez = getopt(argc,argv,"hf:m:")) != -1)
{
switch (rez)
{
case 'h':
printf("found argument \"h\".\n");
break;
case 'f':
printf("found argument \"f = %s\".\n",optarg);
break;
case 'm':
printf("found argument \"m = %s\".\n",optarg);
break;
case '?':
printf("Error found !\n");
break;
};
};
}