fseek() からのftell()は推奨されないそうです。
fstatを使うといいよ。
#include <io.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <share.h>
FILE *fp;
long file_size;
char *buffer;
struct stat stbuf;
int fd;
fd = open("foo.bin", O_RDONLY);
if (fd == -1) {
/* エラー処理 */
}
if (fstat(fd, &stbuf) == -1) {
/* エラー処理 */
}
file_size = stbuf.st_size;
_close(fd);