FileIF.replaceReadwrite

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.

interface FileIF
replaceReadwrite

Parameters

etag string

an optional [entity tag][gfile-etag] for the current GFile, or NULL to ignore

makeBackup bool

TRUE if a backup should be created

flags GFileCreateFlags
cancellable Cancellable

optional gio.Cancellable object, NULL to ignore

Return Value

a gio.FileIOStream or NULL on error. Free the returned object with g_object_unref().

Throws

GException on failure.

Meta

Since

2.22