Using the C Programming Language and getting input using getopt. If we have used the command line at we should be used to providing command line options such as ping -c or ls -l; the options -l, -c etc can be read from within the program using the getopt function from the getopt.h header file. For more information you can read the man page , man 3 getopt if you are using Linux. Using the Raspbian OS on the Raspberry Pi this tutorial looks at creating a program in C that can be used to convert temperatures from Centigrade to Fahrenheit and vice versa. We will use getopt to search for the options -c and -f to ensure that the correct calculation is applied.
7 окт 2024