- Function
Parse command line options.
- Header
- Declaration
int __fastcall__ getopt (int argc, char* const* argv, const char* optstring);
- Description
The function parses command line arguments,
argc
andargv
are the argument count and array passed tomain
.optstring
is a string that contains command line option characters. If a character inoptstring
is followed by a colon, the option requires an argument. An option on the command line is recognized if it is one of the option characters preceeded by a '-'.getopt
must be called repeatedly. It will return each option character found on the command line andEOF
(-1) if there is no other option. An option argument is placed inoptarg
, the index of the next element on the command line to be processed is placed inoptind
.- Limits
- The implementation will not reorder options. A non option on the command line will terminate option processing. All remaining arguments are not recognized as options, even if the start with a '-' character.
- The function is only available as fastcall function, so it may only be used in presence of a prototype.
- Availability
POSIX.2
- Example
None.