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

Glib::RefPtr< IOChannel > Glib::IOChannel::create_from_file ( const std::string &  filename,
const std::string &  mode 
) [static, inherited]

Open a file filename as an I/O channel using mode mode. This channel will be closed when the last reference to it is dropped, so there is no need to call close() (though doing so will not cause problems, as long as no attempt is made to access the channel after it is closed).

Parameters:
filename The name of the file to open.
mode One of "r", "w", "a", "r+", "w+", "a+". These have the same meaning as in fopen().
Returns:
An IOChannel for the opened file.
Exceptions:
Glib::FileError 

Definition at line 179 of file iochannel.cc.

{
  GError* error = 0;
  GIOChannel *const channel = g_io_channel_new_file(filename.c_str(), mode.c_str(), &error);

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

  return Glib::wrap(channel, false);
}


Generated by  Doxygen 1.6.0   Back to index