From c9b6b9a5ca082fe7c1b6f58d7713f785a9eb6a5c Mon Sep 17 00:00:00 2001 From: Martial Simon Date: Mon, 15 Sep 2025 01:08:27 +0200 Subject: add: graphs et rushs --- graphs/cpp/directories_infos/main_example.cc | 32 ++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 graphs/cpp/directories_infos/main_example.cc (limited to 'graphs/cpp/directories_infos/main_example.cc') diff --git a/graphs/cpp/directories_infos/main_example.cc b/graphs/cpp/directories_infos/main_example.cc new file mode 100644 index 0000000..db4bfa0 --- /dev/null +++ b/graphs/cpp/directories_infos/main_example.cc @@ -0,0 +1,32 @@ +#include +#include +#include + +#include "directory_info.hh" +#include "read_info.hh" + +int main(int argc, char** argv) +{ + if (argc < 2) + return 1; + + auto file = std::ifstream(argv[1]); + + DirectoryInfo dir_info; + + while ((dir_info = read_info(file)).is_valid()) + { + std::stringstream str_stream; + str_stream << dir_info.get_name() << ' ' << dir_info.get_size() << ' ' + << std::oct << dir_info.get_rights() << std::dec << ' ' + << dir_info.get_owner() << '\n'; + + dir_info = read_info(str_stream); + if (!dir_info.is_valid()) + break; + + std::cout << dir_info.get_name() << '|' << dir_info.get_size() << '|' + << std::oct << dir_info.get_rights() << std::dec << '|' + << dir_info.get_owner() << '\n'; + } +} -- cgit v1.2.3