How can I get only the first 100 numbers(negative, integers, and floats) from a file that has numbers, spaces, and characters.
I was using this at the moment, but I think fgets is not the best command to use for this.
int readFile (FILE* fp)
{
char number[101] = "test";
//printf ("%s\n", number);
fgets(number, 101, fp);
//fscanf(fp, "%s", number);
printf ("%s", number);
return 0;
}
I suppose this current method could be used if spaces and unwanted characters were deleted, but currently this is not even working unless there are no spaces in the file.
here is an example of a file
44.5 -55 93942 11 text text text 333.55 999999999999 1111