Welcome to the forums!
Yes, your suspicions are correct. You need to reposition the file pointer at the beginning of the file. You use the fseek() function to position the file pointer.
Code:
fseek(stream, 0, SEEK_SET); /* Set the file pointer to the beginning of the file. */
--
Code:
char x[12],y[12],z[12];
int i=0;
char *forpop = "%s %s %s\n";
while (fscanf (stream, forpop, x, y, z) == 3)
This is not a safe way to use fscanf(). If one of the strings is more than 11 characters long your program will crash or be compromised. You need to set maximum string lengths in the format string.
Code:
char x[12],y[12],z[12];
int i=0;
char *forpop = "%.11s %.11s %.11s\n";
while (fscanf (stream, forpop, x, y, z) == 3)
--
Code:
float x[i], y[i], z[i], b;
For this to compile, you must be using a modern C99 compatible compiler. However, you should be aware that this will not compile on the many compilers that do not yet implement C99. For these compilers the size of an array must be a compile-time constant. To create dynamic arrays with these compilers you typically use malloc() to allocate memory at run-time.
--
Code:
b = fscanf (stream, del, x[g], y[g], z[g]);
You need to give fscanf the address of float variables so it can put values in rather than float values themselves. Remember, there is no such thing as pass by reference in C.
Code:
b = fscanf (stream, del, &x[g], &y[g], &z[g]);
--
If you are still having troubles after implementing these fixes, please post a sample of the input file as well as a sample of the output you are getting.