get_data
Description:
public bool get_data (string filename, out uint8[] contents) throws FileError
Reads an entire file into allocated memory, with good error checking.
If the call was successful, it returns true and sets contents to the file contents and
contents.length to the length of the file contents in bytes. The string stored in contents will be nul-terminated, so for
text files you can pass null for the contents.length argument. If the call was not successful, it
returns false and sets throws. The error domain is
g_file_error. Possible error codes are those in the
FileError enumeration. In the error case, contents is set to
null and contents.length is set to zero.
Parameters:
| filename |
name of a file to read contents from, in the GLib file name encoding |
| contents |
location to store an allocated string, use g_free to free the returned string |
| length |
location to store length in bytes of the contents, or null |
Returns:
|
true on success, false if an error occurred |