Using C / C ++ getopt_long()can be used to parse command line arguments. Is it possible to tell the function that some of the parameters are required? For example, how can I say getopt_longthat parsing should throw an error if the call startServeris called without mentioning the port below?
getopt_long()
getopt_long
startServer
./startServer -port 80
Note. I am not talking about parameter arguments as mandatory, but about the parameters themselves.
getopt_long() is not part of the C language. This is a GNU invention that is available in some C implementations, but not all.
getopt_long() glibc ( Linux) , . , .