Logo Search packages:      
Sourcecode: ardour version File versions  Download package

std::string Glib::file_get_contents ( const std::string &  filename  ) 

Reads an entire file into a string, with good error checking.

Parameters:
filename A file to read contents from.
Returns:
The file contents.
Exceptions:
Glib::FileError 

Definition at line 175 of file fileutils.cc.

{
  ScopedPtr<char> contents;
  gsize   length = 0;
  GError* error  = 0;

  g_file_get_contents(filename.c_str(), contents.addr(), &length, &error);

  if(error)
    Glib::Error::throw_exception(error);

  return std::string(contents.get(), length);
}


Generated by  Doxygen 1.6.0   Back to index