I'm trying to port an app with some file interactions. I used to use only the stdio.h to open, read, write and close my text file, but now, I want to do this using the gnome VFS.
Then, I've re-developed all the code, and I may open, read, write and close the file using the gnome VFS. However, when I close my app and run it again my file is erased by the gnome_vfs_open_uri(&handle, uri, GNOME_VFS_OPEN_WRITE), I mean, all the content of my file is erased.
Following there is a piece of my code:
gchar *File = "/home/asp/test.txt";
GnomeVFSHandle *handle;
GnomeVFSURI *uri = gnome_vfs_uri_new(File);
GnomeVFSResult result;
if (!gnome_vfs_uri_exists(uri)) {
g_print("Creating History file\n");
if (gnome_vfs_create_uri(&handle, uri, GNOME_VFS_OPEN_WRITE, 1, 0666)!=GNOME_VFS_OK) {
g_print("Could not create a history file\n");
return NS_ERROR_FAILURE;
}
gnome_vfs_close(handle);
}
if (gnome_vfs_open_uri(&handle, uri, GNOME_VFS_OPEN_WRITE)) {
g_print("Could not open URI\n");
return NS_ERROR_FAILURE;
}
GnomeVFSFileSize written;
gnome_vfs_write (handle, (gpointer)"some text", 9, &written);
gnome_vfs_close(handle);
thanks in advance,
--
André Pedralho
Bachelor in Computer Science
Instituto Nokia de Tecnologia
_______________________________________________ gnome-vfs-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/gnome-vfs-list
