A Gentle Programming Primer

Using GnomeVFS in an existing application, or writing a new application with it, is actually very simple since GnomeVFS tries to mimic POSIX file access syntax and semantics. That means that most "standard unix calls" have a GnomeVFS equivalent that operates in a fairly similar manner. There are a few differences to keep in mind.

By way of example, consider the basic read command:
	ssize_t read (int fd, void *buf, size_t count);
      

The GnomeVFS equivalent is very similar, but you will notice slightly different data types. The consistent returning of a GnomeVFSResult also necessitated moving the return value of read into a pass-back-value pointer bytes_read:
	GnomeVFSResult gnome_vfs_read (GnomeVFSHandle *handle,
	                               gpointer buffer,
                                       GnomeVFSFileSize bytes,
                                       GnomeVFSFileSize *bytes_read);
      


Conversion of a Sample Code Block