Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
#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?)" <<
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment