Virtual Method

GioFilereplace_readwrite

since: 2.22

Declaration [src]

GFileIOStream*
replace_readwrite (
  GFile* file,
  const char* etag,
  gboolean make_backup,
  GFileCreateFlags flags,
  GCancellable* cancellable,
  GError** error
)

Description [src]

Returns an output stream for overwriting the file in readwrite mode, possibly creating a backup copy of the file first. If the file doesn’t exist, it will be created.

For details about the behaviour, see g_file_replace() which does the same thing but returns an output stream only.

Note that in many non-local file cases read and write streams are not supported, so make sure you really need to do read and write streaming, rather than just opening for reading or writing.

Available since: 2.22

Parameters

etag

Type: const char*

An optional entity tag for the current GFile, or NULL to ignore.

The argument can be NULL.
The data is owned by the caller of the method.
The value is a NUL terminated UTF-8 string.
make_backup

Type: gboolean

TRUE if a backup should be created.

flags

Type: GFileCreateFlags

A set of GFileCreateFlags.

cancellable

Type: GCancellable

Optional GCancellable object, NULL to ignore.

The argument can be NULL.
The data is owned by the caller of the method.
error

Type: GError **

The return location for a recoverable error.

The argument can be NULL.
If the return location is not NULL, then you must initialize it to a NULL GError*.
The argument will be left initialized to NULL by the virtual function if there are no errors.
In case of error, the argument will be set to a newly allocated GError; the caller will take ownership of the data, and be responsible for freeing it.

Return value

Type: GFileIOStream

A GFileIOStream or NULL on error. Free the returned object with g_object_unref().

The caller of the method takes ownership of the returned data, and is responsible for freeing it.