Read the file: fscanf()

#include <stdio.h>
void main() {
  FILE *fp;
  char buff[255]; // Create a char array to store file data
  fp = fopen("file.txt", "r");
  while(fscanf(fp, "%s", buff) != EOF) {
    printf("%s ", buff);
  }
  fclose(fp);
}
Comments