g_fopen and friends: should also state how to close a stream
Submitted by Øystein Johansen
Link to original bug (#572466)
Description
Documentation Section: Reference doc for glib. A wrapper for the stdio fopen() function. The fopen() function opens a file and associates a new stream with it.
Because file descriptors are specific to the C library on Windows, and a file descriptor is partof the FILE struct, the FILE pointer returned by this function makes sense only to functions in the same C library. Thus if the GLib-using code uses a different C library than GLib does, the FILE pointer returned by this function cannot be passed to C library functions like fprintf() or fread().
See your C library manual for more details about fopen().
filename : a pathname in the GLib file name encoding (UTF-8 on Windows) mode : a string describing the mode in which the file should be opened Returns : A FILE pointer if the file was successfully opened, or NULL if an error occurred
Since 2.6
Correct version:
Other information: I suggest that the documentation also says how to close an open file. You actually have to google around and browse other source file to find that there is no g_close(). A coder may wonder: "Is it ok to close the file with close() when it's opened with g_fopen()?"