import .txt and split word into array C

Hi, if I want to import .txt file that contain information and the number separate by space how can I split and put into array In C

Example of .txt file

3 Aqaba
49789 10000 5200 25.78
6987 148976 12941 15.78
99885 35262 2501 22.98

Thank

You need to look at the manpage of strtok as it will spilt up each line based on the field delimiter...which in this case will be a space character and post how the output should look like...

#include <stdio.h> 

int DisplayFile(char filename[]) 
{ 
    FILE *f; 
    int     ch;  /* int or signed char. See below. */ 
    f = fopen(filename, "r"); 
    if (f == NULL) { 
        /* Couldn't open the file. */ 
        printf("Input file not found.\n"); 
        return -1; /* Non-zero means error. */ 
    } 
    /* Display the entire file on the screen */ 
    ch = fgetc(f); 
    while (ch != EOF) 
    { 
        ch = strtok(filename, " ");
        putchar(ch);  /* Display one char on screen */ 
        ch = fgetc(f); 
    } 
    return 0; 
} 
int main(void) 
{ 
    int   result; 
    result = DisplayFile("fadata.rtf"); 
    return result; 
}

it not working

I just want split and store into array or make it variable to use to calculate other thing

I notice you're spamming multiple topics. I'll reply in your other one.