mesh_conv::MC_file_helper Class Reference

helper class with files More...

#include <MC_string_helper.hpp>

List of all members.

Static Public Member Functions

static MC_file_helper copy (const std::string &input_filename, const std::string &output_filename)
 copy the content of a file into an other one

Detailed Description

helper class with files

Definition at line 149 of file MC_string_helper.hpp.


Member Function Documentation

MC_file_helper mesh_conv::MC_file_helper::copy ( const std::string &  input_filename,
const std::string &  output_filename 
) [static]

copy the content of a file into an other one

Returns:
an instance of MC_file_helper
Parameters:
std::string& the name of the file to copy
std::string& the name of the file receiving the copy

Definition at line 80 of file MC_string_helper.cpp.

00081   {
00082       std::ifstream input(input_filename.c_str(),std::ifstream::in);
00083       std::ofstream output(output_filename.c_str(),std::ifstream::out);
00084 
00085       if(input.is_open()==false)
00086       {std::cout<<"Error in MC_file_helper::copy("<<input_filename<<","<<output_filename<<"), the file "<<input_filename<<" cannot be opened"<<std::endl;exit(-1);}
00087       if(output.is_open()==false)
00088       {std::cout<<"Error in MC_file_helper::copy("<<input_filename<<","<<output_filename<<"), the file "<<output_filename<<" cannot be opened"<<std::endl;exit(-1);}
00089 
00090       char buffer[static_cast<int>(pow(2,16))];
00091       while(input.good())
00092       {
00093           input.getline(buffer,static_cast<int>(pow(2,16)));
00094           if(input.good())
00095               output<<std::string(buffer)+"\n";
00096       }
00097 
00098 
00099       input.close();
00100       output.close();
00101 
00102       return MC_file_helper();
00103   }


The documentation for this class was generated from the following files:

Generated on Sun Apr 18 20:24:48 2010 by  doxygen 1.6.1