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 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 length argument. If the call was not successful, it returns
false and sets error. The error domain is G_FILE_ERROR. Possible error
codes are those in the GLib.FileError enumeration. In the error case,
contents is set to null and length is set to zero.
Parameters
filename: string
name of a file to read contents from, in the GLib file name encoding
Reads an entire file into allocated memory, with good error checking.
If the call was successful, it returns
trueand setscontentsto the file contents andlengthto the length of the file contents in bytes. The string stored incontentswill be nul-terminated, so for text files you can passnullfor thelengthargument. If the call was not successful, it returnsfalseand setserror. The error domain isG_FILE_ERROR. Possible error codes are those in the GLib.FileError enumeration. In the error case,contentsis set tonullandlengthis set to zero.