I am trying to simply read in a basic text file, split each line into separate strings and rearrange/copy them onto a new text file. Is there any simple way to split and identify these strings to be added to a new file at the end of processing the lines?
My code so far:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
FILE *pFileCust
fPointer = fopen("Athletes.txt", "r");
char singleLine[150];
while (!feof(pFileCust)){
fscanf(singleLine, 150);
int id, name, sport;
fprintf(%d[0,6], %s[8,15], %s[16,22], id, name, sport);
}
fclose(fPointer);
return 0;
}
Example Text File to be read into the program:
88888 John Doe Tennis
99999 Jane Smith Softball
Example Output that I am trying to achieve.
Tennis 88888 John Doe
Softball 99999 Jane Smith