/*-------------------------------------------------------------------*/ /* mcluster.c Mohammad Rezaei */ /* */ /* grid-based clustering of markers */ /* */ /* Version: 0.00 */ /* Last updated : 16.6.2014 */ /*-------------------------------------------------------------------*/ #define ProgName "mcluster" #define pi 3.14159265358979323846 #include #include #include #include #include #include "math.h" typedef struct { char outputFilename[300]; char inputFilename[300]; } PARAMS; PARAMS parseInputArgs(int argc, char** argv) { int c; PARAMS params; opterr = 0; while ((c = getopt (argc, argv, "f:i:")) != -1) { switch (c) { case 'f': strcpy(params.outputFilename, optarg); break; case 'i': strcpy(params.inputFilename, optarg); break; default: break; } } return params; } int main(int argc, char* argv[]) { PARAMS params; char t[100]; FILE *fp1, *fp2, *fp3; int i; params = parseInputArgs(argc, argv); fp3 = fopen("kk.txt", "w"); fclose(fp3); fp1 = fopen(params.inputFilename, "r"); fp2 = fopen(params.outputFilename, "w"); printf("this is a test!\n"); for ( i = 0 ; i < 5 ; i++ ) { fscanf(fp1, "%s\n", &t); fprintf(fp2, "%s\n", t); } fclose(fp1); fclose(fp2); return 0; } /* main() */