C言語でファイルの情報を取得するためにはstat関数を使う。
使い方
sys/stat.hをインクルードする必要がある。
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdio.h>
struct stat st; //stat 構造体の変数を用意
stat(ent_name,&st); // stat構造体にファイル情報を格納
printf("File size: %s", st.st_size) #サイズを表示