W
waffle.horn
Hi,
if this makes sense i want to create a function that can be called so
that it reads a single line from a file, then after using the
information destroys it. Such that when the function is called that
line of info does not exist anymore in the file.
for example i have created a short example of where i am at, but I
dont know how to alter what im doing so that i just read in a single
line
while (fgets(line, STRING_LENGTH, obs_fp) != NULL) {
d->projectday++;
if(sscanf(line, "%d %lf %lf", &(d->yearday), &(d->temp), &(d-
\n", *argv, obs_fn, (int)k+1);
exit(1);
}
k++;
nrobs++
return (nrobs);
I want as I said to be able to call this use a single line of info
from the file and remove it from memory, so that when i call the
function again it will be working on the second line and so on.
i hope this makes sense.
Many thanks
J.
if this makes sense i want to create a function that can be called so
that it reads a single line from a file, then after using the
information destroys it. Such that when the function is called that
line of info does not exist anymore in the file.
for example i have created a short example of where i am at, but I
dont know how to alter what im doing so that i just read in a single
line
while (fgets(line, STRING_LENGTH, obs_fp) != NULL) {
d->projectday++;
if(sscanf(line, "%d %lf %lf", &(d->yearday), &(d->temp), &(d-
fprintf(stderr, "%s: badly formatted input in file: %s on line %dmaxt[k])) != 3) {
\n", *argv, obs_fn, (int)k+1);
exit(1);
}
k++;
nrobs++
return (nrobs);
I want as I said to be able to call this use a single line of info
from the file and remove it from memory, so that when i call the
function again it will be working on the second line and so on.
i hope this makes sense.
Many thanks
J.