Skip to content
Snippets Groups Projects
Commit 03e7489b authored by Robert Klöfkorn's avatar Robert Klöfkorn
Browse files

use string instead of char *

[[Imported from SVN: r2016]]
parent 14c79e87
No related branches found
No related tags found
No related merge requests found
......@@ -136,23 +136,23 @@ namespace Dune {
//! write data of discrete function to file filename|timestep
//! with xdr methods
bool write_xdr( const char *filename );
bool write_xdr( const std::basic_string<char> filename );
//! write data of discrete function to file filename|timestep
//! with xdr methods
bool read_xdr( const char *filename );
bool read_xdr( const std::basic_string<char> filename );
//! write function data to file filename|timestep in ascii Format
bool write_ascii(const char *filename);
bool write_ascii(const std::basic_string<char> filename);
//! read function data from file filename|timestep in ascii Format
bool read_ascii(const char *filename);
bool read_ascii(const std::basic_string<char> filename);
//! write function data in pgm fromat file
bool write_pgm(const char *filename );
bool write_pgm(const std::basic_string<char> filename );
//! read function data from pgm fromat file
bool read_pgm(const char *filename);
bool read_pgm(const std::basic_string<char> filename);
//! return name of this discrete function
const char * name () const { return name_; }
......
......@@ -141,14 +141,14 @@ namespace Dune
//**************************************************************************
template<class DiscreteFunctionSpaceType >
inline bool DFAdapt< DiscreteFunctionSpaceType >::
write_xdr( const char *fn )
write_xdr( const std::basic_string<char> fn )
{
FILE *file;
XDR xdrs;
file = fopen(fn, "wb");
file = fopen(fn.c_str(), "wb");
if (!file)
{
printf( "\aERROR in DFAdapt::write_xdr(..): couldnot open <%s>!\n", fn);
printf( "\aERROR in DFAdapt::write_xdr(..): couldnot open <%s>!\n", fn.c_str());
fflush(stderr);
return false;
}
......@@ -164,15 +164,15 @@ namespace Dune
template<class DiscreteFunctionSpaceType >
inline bool DFAdapt< DiscreteFunctionSpaceType >::
read_xdr( const char *fn )
read_xdr( const std::basic_string<char> fn )
{
FILE *file;
XDR xdrs;
std::cout << "Reading <" << fn << "> \n";
file = fopen(fn, "rb");
file = fopen(fn.c_str() , "rb");
if(!file)
{
printf( "\aERROR in DFAdapt::read_xdr(..): couldnot open <%s>!\n", fn);
printf( "\aERROR in DFAdapt::read_xdr(..): couldnot open <%s>!\n", fn.c_str());
fflush(stderr);
return(false);
}
......@@ -188,12 +188,12 @@ namespace Dune
template<class DiscreteFunctionSpaceType >
inline bool DFAdapt< DiscreteFunctionSpaceType >::
write_ascii( const char *fn )
write_ascii( const std::basic_string<char> fn )
{
std::fstream outfile( fn , std::ios::out );
std::fstream outfile( fn.c_str() , std::ios::out );
if (!outfile)
{
printf( "\aERROR in DFAdapt::write_ascii(..): couldnot open <%s>!\n", fn);
printf( "\aERROR in DFAdapt::write_ascii(..): couldnot open <%s>!\n", fn.c_str());
fflush(stderr);
return false;
}
......@@ -216,10 +216,10 @@ namespace Dune
template<class DiscreteFunctionSpaceType >
inline bool DFAdapt< DiscreteFunctionSpaceType >::
read_ascii( const char *fn )
read_ascii( const std::basic_string<char> fn )
{
FILE *infile=0;
infile = fopen( fn, "r" );
infile = fopen( fn.c_str(), "r" );
assert(infile != 0);
{
int length;
......@@ -238,7 +238,7 @@ namespace Dune
template<class DiscreteFunctionSpaceType >
inline bool DFAdapt< DiscreteFunctionSpaceType >::
write_pgm( const char *fn )
write_pgm( const std::basic_string<char> fn )
{
std::ofstream out( fn );
......@@ -264,12 +264,12 @@ namespace Dune
template<class DiscreteFunctionSpaceType >
inline bool DFAdapt< DiscreteFunctionSpaceType >::
read_pgm( const char *fn )
read_pgm( const std::basic_string<char> fn )
{
FILE *in;
int v;
in = fopen( fn, "r" );
in = fopen( fn.c_str(), "r" );
assert(in);
fscanf( in, "P2\n%d %d\n%d\n", &v, &v, &v );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment