Based on the response to Size of file using C++17, I wrote the following program. But, when the executable is run, I get a segmentation fault. I am using g++ 8.3.0 on an iMac running High Sierra.
// c17filesize.cpp
// Jul-02-2019
#include <cstring>
#include <filesystem>
using namespace std;
int main(int argc, char **argv)
{
char filename[100];
(argc > 1) ? strcpy(filename, argv[1]) : strcpy(filename, __FILE__);
auto size = filesystem::file_size(filename);
}