Linux equivalent of GetCommandLine and CommandLineToArgv?

后端 未结 4 2074

I wonder if there are some API to get the current process\' command line arguments on Linux.


I guess I was terribly unclear. The real purpose of the question was a

4条回答
  •  无人共我
    2021-02-14 17:43

    checkout Getopt It's a command line parsing library that's implemented in many languages including C.

    Otherwise:

    int main(int argc, char *argv[])
    

    argv is an array of arguments as char* and argc is the number of arguments.

    argv[0] is always the executable filename itself.

提交回复
热议问题