c
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| c [2009/07/23 12:40] – created tkbletsc | c [2009/08/13 09:51] (current) – tkbletsc | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | getopt | + | GO TO THE C [[c:index]]. |
| - | <code=c> | + | |
| - | #include <unistd.h> | + | |
| - | #include < | + | |
| - | #include < | + | |
| - | int main (int argc, char** argv) { | ||
| - | |||
| - | int o; | ||
| - | int opt_a; | ||
| - | char* opt_c; | ||
| - | while ((o = getopt (argc, argv, " | ||
| - | switch (o) { | ||
| - | case ' | ||
| - | opt_a = 1; | ||
| - | printf(" | ||
| - | break; | ||
| - | case ' | ||
| - | opt_c = optarg; | ||
| - | printf(" | ||
| - | break; | ||
| - | case '?': | ||
| - | // | ||
| - | exit(1); | ||
| - | } | ||
| - | } | ||
| - | argc -= optind; argv += optind; // throw away option arguments | ||
| - | |||
| - | } | ||
| - | |||
| - | </ | ||
c.1248378025.txt.gz · Last modified: by tkbletsc
