As you may be aware I'm reading in a text file pre writting this out again but with a header added to it.
The input text files can be quite large in size (read this as number of lines) so I need to get this read / write to be as quick as possible. Experimentation has found that using the fstream approach is very slow compared to using the c fscanf approach, so I'm using the fscanf ,ethod
However, as you can see from the following code I'm reading in each part of the input file into 3 variables. How can I read the whole line at once into a single string, thereby saving tiime?
Is there also a way I can just read in the fist character of a line (I assume I could use fgetc), but how do I then jump to the next line?Code:
fscanf(finput,"%f %f %f",&x,&y,&z);