00001 /* Copyright (C) 2000-2008 Stefan Buehler <sbuehler@ltu.se> 00002 00003 This program is free software; you can redistribute it and/or modify it 00004 under the terms of the GNU General Public License as published by the 00005 Free Software Foundation; either version 2, or (at your option) any 00006 later version. 00007 00008 This program is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00011 GNU General Public License for more details. 00012 00013 You should have received a copy of the GNU General Public License 00014 along with this program; if not, write to the Free Software 00015 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 00016 USA. */ 00017 00018 00020 // File description 00022 00032 #ifndef file_h 00033 #define file_h 00034 00035 #include <fstream> 00036 #include "matpackI.h" 00037 #include "mystring.h" 00038 00040 // Default file names 00042 00043 void filename_ascii( 00044 String& filename, 00045 const String& varname ); 00046 00047 void filename_bin( 00048 String& filename, 00049 const String& varname ); 00050 00051 00052 00054 // Functions to open and read ASCII files 00056 00057 void open_output_file(ofstream& file, const String& name); 00058 00059 void open_input_file(ifstream& file, const String& name); 00060 00061 void read_text_from_stream(ArrayOfString& text, istream& is); 00062 00063 void read_text_from_file(ArrayOfString& text, const String& name); 00064 00065 void replace_all(String& s, const String& what, const String& with); 00066 00067 int check_newline(const String& s); 00068 00069 bool file_exists (const String& filename); 00070 00071 bool find_file (String& filename, const char* extension); 00072 00073 #endif