Skip to content

Instantly share code, notes, and snippets.

@Donpedro13
Created February 11, 2018 15:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Donpedro13/e6c8368fd136d8b38b2044f8fd222c86 to your computer and use it in GitHub Desktop.
Save Donpedro13/e6c8368fd136d8b38b2044f8fd222c86 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <sys/stat.h>
int main (int /*argc*/, char* argv[])
{
struct stat fileInfo;
if (stat (argv[1], &fileInfo) == 0) {
std::cout << "The file's size is: " << fileInfo.st_size <<
" bytes" << std::endl;
} else {
std::cout << "Unable to stat file (maybe it doesn't exist?)" <<
std::endl;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment