Created
February 11, 2018 15:19
-
-
Save Donpedro13/e6c8368fd136d8b38b2044f8fd222c86 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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