void html_get(char* path, char* file) { struct stat sb; FILE* html; char* buffer; char fullpath[1024]; /* File & path name exceed system limits */ if (strlen(path) + strlen(file) > 1024) return; sprintf(fullpath, "%s/%s", path, file); if (stat(fullpath, &sb)) return; buffer = (char*)calloc(1, sb.st_size + 1); if (!buffer) return; html = fopen(fullpath, "r"); fread((void*)buffer, 1, sb.st_size, html); fclose(html); puts(buffer); free(buffer); }