技术栈

getopt_long

技术探索者
2 年前
linux·c语言·getopt_long
Linux:linux getopt_long()函数(命令行解析)(getopt、getopt_long_only)(短选项 -,长选项 --)在linux中,经常需要各种命令,通常情况下都会带各种参数,而这些参数是如何解析的呢?通常使用GNU C提供的函数getopt、getopt_long、getopt_long_only函数来解析命令行参数。