Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*******************************************
- * Author : Diego Cordoba / @d1cor *
- * Purpose : juncotic.com - JuncoTIC *
- * Contact : diego@juncotic.com *
- *******************************************/
- #include<stdio.h>
- #include<stdlib.h>
- #include<sys/types.h>
- #include<sys/stat.h>
- #include<unistd.h>
- #include<dirent.h>
- #include<fcntl.h>
- #include<errno.h>
- int main(int argc, char** argv) {
- int i=0;
- char c;
- opterr=0;
- printf("Cantidad de argumentos: %d\n",argc);
- for(i=0;i<argc;i++){
- printf("(%d)---> %s\n",i,*(argv+i));
- }
- while((c=getopt(argc, argv, "abc:"))!=-1){
- switch(c){
- case 'a':
- printf("Un caracter 'a'\n");
- break;
- case 'b':
- printf("Un caracter 'b'\n");
- break;
- case 'c':
- printf("Un caracter 'c' con argumento %s\n",optarg);
- break;
- default:
- printf("Error de lectura\n");
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement