Go to the documentation of this file.
106 file.exceptions(ios::badbit |
110 file.open(ename.c_str() );
120 os <<
"Cannot open output file: " << ename <<
'\n'
121 <<
"Maybe you don't have write access "
122 <<
"to the directory or the file?";
123 throw runtime_error(os.str());
140 streampos fpos = file.tellp();
168 file.exceptions(ios::badbit);
171 file.open(ename.c_str() );
179 os <<
"Cannot open input file: " << ename <<
'\n'
180 <<
"Maybe the file does not exist?";
181 throw runtime_error(os.str());
205 while (is && is.good() && !is.eof())
208 getline(is,linebuffer);
211 text.push_back(linebuffer);
219 os <<
"Read Error. Last line read:\n" << linebuffer;
220 throw runtime_error(os.str());
254 catch (runtime_error x)
257 os <<
"Error reading file: " << name <<
'\n'
259 throw runtime_error(os.str());
276 if ((path.
nelem() == 1 && path[0] ==
'~')
277 || (path.
nelem() > 1 && path[0] ==
'~' && path[1] ==
'/'))
298 Index j = s.find(what);
299 while ( j != s.
npos )
302 j = s.find(what,j+with.size());
327 const char *cp = d.c_str ();
328 while ((*cp ==
'\n') && *cp) cp++;
333 if (!result && d[d.length () - 1] !=
'\n')
335 else if (!result && d.length () > 2
336 && d[d.length () - 1] ==
'\n' && d[d.length () - 2] ==
'\n')
357 fin.open(filename.c_str(), ios::in);
388 filename += extension;
404 filename = fullpath + extension;
Structure to hold all command line Parameters.
void cleanup_output_file(ofstream &, const String &)
Closes the file.
void open_input_file(ifstream &file, const String &name)
Open a file for reading.
This file contains the definition of Array.
bool find_file(String &filename, const char *extension)
Find the given file.
This can be used to make arrays out of anything.
void read_text_from_stream(ArrayOfString &text, istream &is)
Read an ASCII stream and append the contents to the String array text.
Declarations having to do with the four output streams.
The implementation for String, the ARTS string class.
bool file_exists(const String &filename)
Checks if the given file exists.
This file contains header information for the dealing with command line parameters.
String out_basename
The basename for the report file and for all other output files.
void open_output_file(ofstream &file, const String &name)
Open a file for writing.
Index nelem() const
Number of elements.
void read_text_from_file(ArrayOfString &text, const String &name)
Reads an ASCII file and appends the contents to the String vector text.
String expand_path(const String &path)
Parameters parameters
Holds the command line parameters.
my_basic_string< char > String
The String type for ARTS.
int check_newline(const String &s)
Checks if there is exactly one newline character at the end of the string.
void filename_ascii(String &filename, const String &varname)
Gives the default file name for the ASCII formats.
This file contains basic functions to handle ASCII files.
INDEX Index
The type to use for all integer numbers and indices.
static const Index npos
Define npos:
ArrayOfString includepath
List of paths to search for include files.
Index nelem() const
Number of elements.
The global header file for ARTS.
void replace_all(String &s, const String &what, const String &with)
Replace all occurances of ‘what’ in ‘s’ with ‘with’.