Hello,

I have an input file that has 3 columns. The first column includes alphanum special characters and spaces as well. It looks like this:

Code:
@ED#@ 11 AAA
!@ R$     22 BBB
!@EDF    33 CCC
EV? %    44 DDD
Here is my code that I wrote to read such files, but obviously, having spaces in the first column makes this code with fscanf inapplicable. I know the width of every column, so I know the number of characters to read. Any suggestions on how I could go about this? Thanks!

Code:
#include <stdio.h>

int main(int argc, char *argv[])
{
        FILE *in, *out;
        char one[11], two[33], three[53];
        int i=1;

        in = fopen(argv[1],"r");
        out = fopen(argv[2],"w");
        while(fscanf(in,"%s  %s  %s  ", one, two, three) != EOF)
        {
                printf("Line %d: One:%s Two:%s Three:%s\n", i++,one, two, three);
                sleep(1);
                //fprintf(out,"insert %s %s%s\n", one, two, three);
        }
        fclose(in);
        fclose(out);
        return 0;
}