I have a project where I need to take different input files and then store different fields and then do some math/calculations on them.
The trick is some of the files have 0 to 4 line headers which need to be ignored. Also, each line has different field lengths.
Here's an example of part of an input file (4 line header):
I need to be able to ignore the header, and then take the first part of the line (0-111-00-) and place into one field and take the (001) into another field.
I guess I would check the file for number of lines first to allocate the array size and then count characters until I hit a space/blank to determine field length?
Here's what I have so far, but am pretty much lost after that!!
int main(int argc, char *argv)
/* Open the file */
fprintf(stderr,"main: no filename given in command line\n");
fname = fopen(argv,"r");
fprintf(stderr,"main: cannot open file \"%s\"\n",argv);
/* Parse the file */
Thanks for the help!