User Tools

Site Tools


c

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
c [2009/07/23 12:41] tkbletscc [2009/08/13 09:51] (current) tkbletsc
Line 1: Line 1:
-getopt +GO TO THE C [[c:index]].
-<code=c+
-#include <unistd.h> +
-#include <stdio.h> +
-#include <stdlib.h>+
  
-int main (int argc, char** argv) { 
- 
- int o; 
- int opt_a; 
- char* opt_c; 
- while ((o = getopt (argc, argv, "abc:")) != -1) { 
- switch (o) { 
- case 'a': 
- opt_a = 1; 
- printf("a=yes\n"); 
- break; 
- case 'c': 
- opt_c = optarg; 
- printf("c='%s'\n",opt_c); 
- break; 
- case '?': 
- exit(1); 
- } 
- } 
- argc -= optind; argv += optind; // throw away option arguments 
-  
-} 
- 
-</code> 
c.1248378087.txt.gz · Last modified: 2009/07/23 12:41 by tkbletsc

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki