I've spent some time searching the internet for an answer, but still didn't find any help. I'd like to read a .txt file and store the values in int width, int height and char message.

**Update: Furthermore I'd like to make the program adaptable in case if the order of the values in read.txt is different.** 

read.txt

```
width 40
height 20
message "Hello"

```

main.c file

```
FILE *file_in = fopen("read.txt", "r");

int width;
int height;
char *message = malloc(sizeof(char)*255);

fscanf(file_in, "width %d", &width);
fscanf(file_in, "height %d", &height);
fscanf(file_in, "message %s", message);

printf("width %d\n", width);
printf("height %d\n", height);

fclose(file_in);
return 0;

```

output

```
width 0
height 0

```

I'm trying to get the correct output. What am I doing wrong? Thank you.