Re: Simple I/O with Gio::???



Am 23.07.2012 17:57, schrieb Arbol One:
> I am looking for a tutorial on simple file I/O using Gio. All I want to
> do is to create/open a file, write to it and then delete it; all this in
> a local machine running Win7.
> 
> I understand that the Gio library can do this simple things.
> 
>  
> 
> TIA
> 
>  

How about this:

#include <giomm/file.h>
#include <giomm/fileoutputstream.h>
#include <glibmm/refptr.h>

void test()
{
 using namespace Glib;
 using namespace Gio;

 RefPtr<File> file = File::create_for_path("test.txt");
 RefPtr<FileOutputStream> stream = file->create_file();
 stream->write("Hello world\n");
 stream->close();

 file->remove();
}

Take a look at the reference documentation. Start with Gio::File.

Regards,
Florian Philipp

Attachment: signature.asc
Description: OpenPGP digital signature



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]