# include # include # include # include extern char *optarg; extern int optind, opterr, optopt; char in[64],out[64]; double fps=0; int i=0,f1, f2, c,n,line=0; char buf[BUFSIZ]; int var=0, br, i; char conv[BUFSIZ], tmp[BUFSIZ]; main(int argc, char *argv[]) { //conv[i] = malloc(BUFSIZ); if (argc != 7){ printf("%s: usage: -i input -o output -f fps\n",argv[0]); return 1; } while((c=getopt(argc, argv, "i:o:f:"))>=0){ switch(c){ case 'i': strcpy(in,optarg); printf("Opcion i: %s\n",in); break; case 'o': strcpy(out,optarg); printf("Opcion o: %s\n",out); break; case 'f': fps=atof(optarg); printf("Opcion f: %f\n",fps); break; } } if ((f1 = open(in, O_RDONLY, 0)) == -1) { printf("%s: no se puede abrir %s\n", argv[0], in); return 1; } // Line counter. /* while ((n = read(f1, buf, 1)) > 0) if(strcmp(buf,"\n")==0) line++; */ // Line separator. /*while ((n = read(f1, buf, 1)) > 0) { // conv[i]=buf[0]; printf("buffer: %s conv: %s\n",buf,conv[i]); i++; if(strcmp(buf,"\n")==0) break; } */ br = read(f1, tmp, BUFSIZ); for(i=var;i