I need to get a clue in how know when to stop storing a string from a file after i hit a space between the words. After i open a file and read it, for example: the first line that is there is:427 671 +. I need to store "427" in an array of int, same with "671" and "+"in a variable.
So far i have figure out how to read the whole line and print it but the problem i have is to read char by char and store it before i hit a space.
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <float.h>
#include <Laboratorio.h>
#include <string.h>
int main(int argc, char **argv) {
FILE *datos;
FILE *resultados;
char bin[64]="",hex[16]="";
int oct[21];
ep = fopen ( argv[1], "r" );
if (ep==NULL) {
printf("Archivo vacio.");
return 0;
}else{
while (fgets(bin,64,ep)!=NULL){
printf("%s",bin);
}
fclose(ep);
}
}