#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
int main(void) {
const char* filename = "d:\\data.txt";
FILE* fp = fopen(filename, "r");
if (!fp)
exit(EXIT_FAILURE);
struct stat sb;
if (stat(filename, &sb) == -1) {
perror("stat");
exit(EXIT_FAILURE);
}
char* file_contents = malloc(sb.st_size);
fread(file_contents, sb.st_size, 1, fp);
printf("%s\n", file_contents);
fclose(fp);
free(file_contents);
return 0;
}
/*
run
c c++ C#
NODEjs eXPRESS
jAVAsCRIPT php
*/