This code reads all the files in the current working directory, prints them line by line, concatenates all the output and prints the combined data to a new file.
- See also
- files::Directory
#include <sstream>
#include <iostream>
void iterate_directory()
{
const auto dir = limes::files::dirs::cwd();
std::stringstream stream;
{
{
std::cout << line << std::endl;
stream << line;
} });
}
void iterateFiles(FileCallback &&callback, bool recurse=true, bool includeHiddenFiles=true) const
Calls a function for each child file that exists in this directory.
File getChildFile(const std::string_view &filename, bool createIfNeeded=false) const
Returns a File object representing a file in this directory with the specified name.
This class represents a file on the filesystem.
std::vector< std::string > loadAsLines() const
Loads the file's contents as a vector of strings, with each string containing the contents of one lin...
bool overwrite(const char *const data, std::size_t numBytes) const noexcept
Replaces the file's contents with the given data.
The main header for the limes_files library.