8.11 Portability Notes


8.11 Portability Notes

Position values (offsets) and file sizes vary from system to system; some platforms support very large files requiring larger integers.

Although GnomeVFS encapsulates the sizes with GnomeVFSFileSize and GnomeVFSFileOffset , you can still encounter problems with file sizes and offsets. The following macros and function can help you write a more portable program:

  • GNOME_VFS_OFFSET_IS_LONG_LONG : Always defined on systems where the Gnome-VFS offset type uses long long rather than long .

  • GNOME_VFS_SIZE_FORMAT_STR : Use this macro behind the % in printf() format strings when printing the file size .

  • GNOME_VFS_OFFSET_FORMAT_STR : Use this behind the % in printf() format strings when printing file positions .

  • gchar *gnome_vfs_format_file_size_for_display(GnomeVFSFileSize size )

    Returns size in a newly allocated string in human-readable form (for example, "180 bytes" or "1.8 GB" ).




The Official GNOME 2 Developers Guide
The Official GNOME 2 Developers Guide
ISBN: 1593270305
EAN: 2147483647
Year: 2004
Pages: 108

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net