gFileReplaceContents {RGtk2} | R Documentation

## gFileReplaceContents

### Description

Replaces the contents of `file` with `contents` of `length` bytes.

If `etag` is specified (not `NULL`) any existing file must have that etag, or the error `G_IO_ERROR_WRONG_ETAG` will be returned.

### Usage

    gFileReplaceContents(object, contents, length, etag, make.backup,
        flags = "G_FILE_CREATE_NONE", cancellable = NULL, .errwarn = TRUE)

### Arguments

``object`` | input `GFile`.
``contents`` | a string containing the new contents for `file`.
``length`` | the length of `contents` in bytes.
``etag`` | the old entity tag for the document, or `NULL`
``make.backup`` | `TRUE` if a backup should be created.
``flags`` | a set of `GFileCreateFlags`.
``cancellable`` | optional `GCancellable` object, `NULL` to ignore.
`.errwarn` | Whether to issue a warning on error or fail silently

### Details

If `make.backup` is `TRUE`, this function will attempt to make a backup of `file`.

If `cancellable` is not `NULL`, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error `G_IO_ERROR_CANCELLED` will be returned.

The returned `new.etag` can be used to verify that the file hasn't changed the next time it is saved over.

### Value

A list containing the following elements:

`retval` | [logical] `TRUE` if successful. If an error has occurred, this function will return `FALSE` and set `error` appropriately if present.
``new.etag`` | a location to a new entity tag for the document. This should be freed with `gFree()` when no longer needed, or `NULL`
``error`` | a `GError`, or `NULL`

### Author(s)

Derived by RGtkGen from GTK+ documentation

[Package RGtk2 version 2.20.36.3 Index]