I'm very new to 'c' and am trying to get some code to work. The code takes in an input file with:
year month date hour minute PAR
It then prints out computations on the screen I believe.
Q1: Where do I edit the code (ie. replace filename with the actual name of my input file?
FILE *in_file;
while((c=getopt(argc, argv, "f:"))!=-1)
switch(c) {
case 'f':
strcpy(filename, optarg);
break;
}
in_file=fopen(filename,"r");
while (fscanf(in_file, "%d%d%d%d%d%lf\n", &year, &month, &date, &hour, &minute, &par )>0){
Q2: Am I right to assume that the input file is an ascii file with 6 columns separated by a single space?
Q3: I've tried to compile the code using g++ w/ redhat after playing around a bit but always get this error:
28:33: error: ‘::main’ must return ‘int’ void main(int argc, char *argv[]){
I'm not sure where to go from here. Any help would be appreciated. The entire code is available at:
Aucun commentaire:
Enregistrer un commentaire