Darwin  1.10(beta)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Functions
drwnFileUtils.h File Reference

File and directory processing utilities. More...

Go to the source code of this file.

Functions

vector< string > drwnDirectoryListing (const char *directory, const char *extension=NULL, bool bIncludeDir=true, bool bIncludeExt=true)
 returns a sorted list of filenames in directory filtered by extension
 
vector< string > drwnDirectoryListing (const char *directory, const set< const char * > &extensions, bool bIncludeDir=true)
 returns a sorted list of filenames in directory with extensions matching one of extensions
 
string drwnGetCurrentDir ()
 returns the current directory path
 
bool drwnChangeCurrentDir (const char *directoryPath)
 changes the current directory (returns true if successful)
 
bool drwnCreateDirectory (const char *directoryPath)
 creates a new directory path
 
bool drwnRemoveDirectory (const char *directoryPath)
 removes a directory and its contents
 
bool drwnRemoveFile (const char *filename)
 removes a file
 
bool drwnIsAbsolutePath (const char *path)
 returns true if the directory path is absolute (starts from root)
 
bool drwnIsRelativePath (const char *path)
 returns true if the directory path is relative to the current directory
 
int drwnCountFields (ifstream *ifs, char delimiter= ' ', bool bSkipRepeated=true)
 counts the number of fields per line (separated by a single character delimiter)
 
vector< string > drwnReadFile (const char *filename)
 read strings (separated by whitespace) from a file
 
vector< string > drwnReadLines (const char *filename)
 read complete lines from a file
 
string drwnReadAll (const char *filename)
 read complete file into a single string
 
int drwnCountLines (const char *filename)
 counts the number of non-empty lines in a text file
 
bool drwnPathExists (const char *pathname)
 checks if a path (directory or file) exists
 
bool drwnFileExists (const char *filename)
 checks if a file exists
 
bool drwnDirExists (const char *dirname)
 checks if a directory exists
 
unsigned int drwnFileSize (const char *filename)
 returns the size of a file in bytes
 
bool drwnFileResize (const char *filename, unsigned int size)
 resizes a file to size bytes
 
int drwnDirSize (const char *dirname)
 returns the number of files and subdirectories in directory (excluding . and ..)
 

Detailed Description

File and directory processing utilities.