From: Andy R. <an...@pl...> - 2003-05-16 15:27:15
|
#include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/stat.h> int main(int argc, char** argv) { const char* name = argv[1]; struct stat data; FILE* f; if(stat(name, &data) != 0) return 1; f = fopen(name, "r"); if(!f) return 1; unsigned char* buf = malloc(data.st_size); int result = fread(buf, 1, data.st_size, f); printf("st_size %d result %d\n", (int)data.st_size, result); return 0; } -- Andrew J. Ross Beyond the Ordinary Plausibility Productions Sole Proprietor Beneath the Infinite Hillsboro, OR Experience... the Plausible? |