Canoe
Comprehensive Atmosphere N' Ocean Engine
fileio.cpp File Reference
#include <cctype>
#include <cstring>
#include <fstream>
#include <sstream>
#include <stdexcept>
#include <vector>
#include <application/exceptions.hpp>
#include "fileio.hpp"
#include "vectorize.hpp"

Go to the source code of this file.

Functions

bool FileExists (std::string fname)
 test file existance More...
 
bool IsBlankLine (char const *line)
 test a blank line More...
 
bool IsBlankLine (std::string const &line)
 
std::string DecommentFile (std::string fname)
 decomment a file More...
 
int GetNumCols (std::string fname, char c)
 get number of columns in a data table More...
 
int GetNumRows (std::string fname)
 get number of rows in a data table More...
 
void replaceChar (char *buf, char c_old, char c_new)
 replace a character in a string More...
 
char * StripLine (char *line)
 
char * NextLine (char *line, int num, FILE *stream)
 
DataVector read_data_vector (std::string fname)
 

Function Documentation

◆ FileExists()

bool FileExists ( std::string  fname)

test file existance

Definition at line 16 of file fileio.cpp.

◆ IsBlankLine() [1/2]

bool IsBlankLine ( char const *  line)

test a blank line

Definition at line 21 of file fileio.cpp.

◆ IsBlankLine() [2/2]

bool IsBlankLine ( std::string const &  line)

Definition at line 28 of file fileio.cpp.

◆ DecommentFile()

std::string DecommentFile ( std::string  fname)

decomment a file

Definition at line 30 of file fileio.cpp.

◆ GetNumCols()

int GetNumCols ( std::string  fname,
char  c 
)

get number of columns in a data table

Definition at line 50 of file fileio.cpp.

◆ GetNumRows()

int GetNumRows ( std::string  fname)

get number of rows in a data table

Definition at line 62 of file fileio.cpp.

◆ replaceChar()

void replaceChar ( char *  buf,
char  c_old,
char  c_new 
)

replace a character in a string

Definition at line 71 of file fileio.cpp.

◆ StripLine()

char* StripLine ( char *  line)

Definition at line 77 of file fileio.cpp.

◆ NextLine()

char* NextLine ( char *  line,
int  num,
FILE *  stream 
)

Definition at line 93 of file fileio.cpp.

◆ read_data_vector()

DataVector read_data_vector ( std::string  fname)

Definition at line 102 of file fileio.cpp.