mxlib
c++ tools for analyzing astronomical data and other tasks by Jared R. Males. [git repo]
Loading...
Searching...
No Matches

Definitions of utilities for working with files. More...

Definitions of utilities for working with files.

Author
Jared R. Males (jared.nosp@m.male.nosp@m.s@gma.nosp@m.il.c.nosp@m.om)

Definition in file fileUtils.cpp.

#include "ioutils/fileUtils.hpp"
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <libgen.h>
#include <cmath>
#include <algorithm>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <filesystem>
#include "../../include/mxException.hpp"

Go to the source code of this file.

Namespaces

namespace  mx
 The mxlib c++ namespace.
 

Functions

bool mx::ioutils::exists (const std::string &path)
 Check if a path exists.
 
int mx::ioutils::createDirectories (const std::string &path)
 Create a directory or directories.
 
std::string mx::ioutils::pathStem (const std::string &fname)
 Get the stem of the filename.
 
std::string mx::ioutils::pathFilename (const std::string &fname)
 Get the base filename.
 
std::string mx::ioutils::parentPath (const std::string &fname)
 Get the parent path from a filename.
 
std::string mx::ioutils::fileNamePrependAppend (const std::string &fname, const std::string &prepend, const std::string &append)
 Prepend and/or append strings to a file name, leaving the directory and extension unaltered.
 
std::string mx::ioutils::fileNameAppend (const std::string &fname, const std::string &append)
 Append a string to a file name, leaving the directory and extension unaltered.
 
std::string mx::ioutils::fileNamePrepend (const std::string &fname, const std::string &prepend)
 Prepend strings to a file name, leaving the directory and extension unaltered.
 
std::string mx::ioutils::getSequentialFilename (const std::string &basename, const std::string &extension="", const int startat=0, int ndigit=4)
 Get the next file in a numbered sequence.
 
off_t mx::ioutils::fileSize (int fd)
 Get the size in bytes of a file.
 
off_t mx::ioutils::fileSize (FILE *f)
 Get the size in bytes of a file pointed to by a FILE pointer.