본문 바로가기

Lecture & Tip/linux programming[리눅스]

How to get file size ? Like this!!

This is a example to get size of specific file.

#include <sys/stat.h>

int main(){
  struct stat buffer;
  stat("FILE LOCATION",&buffer);
  printf("file size : %d\n", buffer.st_size);
}

Is it worthy? kk

I forgot where it is from but I know only found this by google. :)