Handling command line flags in C/C++

前端 未结 7 871
星月不相逢
星月不相逢 2020-12-14 21:03

I am looking for a very simple explanation/tutorial on what flags are. I understand that flags work indicate a command what to do. For example:

rm -Rf test
<         


        
7条回答
  •  春和景丽
    2020-12-14 21:38

    GNU libc, which is very likely available on your system, has a library for this called getopt that can be used to parse the options in a sensible fashion. There are examples to get you started in the documentation linked below.

    http://www.gnu.org/software/libc/manual/html_node/Getopt.html#Getopt

提交回复
热议问题