A simple demonstration of using fz::local_filesysThis example lists the contents of the directory given as argument to the program, or the current working directory if no argument is given.
#include <iostream>
#include <string.h>
int main(int argc, char *argv[])
{
if (argc > 1 && argv[1] && *argv[1] &&
strlen(argv[1]) < 1000) {
}
return 1;
}
std::cout << "----------------------------------\n";
int64_t size;
bool is_link;
bool is_dir;
int mode;
while (fs.
get_next_file(name, is_link, is_dir, &size, &time, &mode)) {
std::cout << " Type: " << (is_link ? "symlinked" : "regular") << (is_dir ? " directory" : " file") << "\n";
if (!is_dir) {
if (size >= 0) {
std::cout << " Size: " << size << " octets" << "\n";
}
}
std::cout <<
" Last modified: " << time.
format(
"%Y-%m-%d %H-%M-%S ", fz::datetime::local) <<
"\n";
}
std::cout << " Mode: " << mode << "\n" << std::endl;
}
return 0;
}