Re: GNOME CVS: gtk+ tml
- From: Owen Taylor <otaylor redhat com>
- To: gtk-devel-list gnome org
- Subject: Re: GNOME CVS: gtk+ tml
- Date: 25 Jul 2000 20:32:26 -0400
Tor Lillqvist <tml@iki.fi> writes:
> Owen Taylor writes:
> > We probably need g_mkstemp.
>
> Hmm, do we want it to be identical to the normal mkstemp(), or do we
> want some extra features in it? Should the file be opened in binary
> mode (on platforms where there is a difference)? Or should there be a
> possibility to pass in extra O_ bits?
Hmmm, I think the function prototype should be the same, or we
need to call it something different.
Unlike fopen (..., "rb"), O_BINARY is not standard C, and not
portable. Since, read() has no business munging the bytes,
I think that always including O_BINARY on systems that have
it is fine, but am not sure of the effects of this on the
larger system --- what is the result of:
fd = open (file, O_BINARY);
fdopen (fd, "r");
If that results in a file open in binary mode, and we actually
want text mode in some places, we might need to have
int g_open_temp_file (char *tmpl, gboolean binary);
As much as I dislike inventing a new API.
> /**
> * g_mkstemp:
> *
> * Open a temporary file
> *
> * The parameter is a string that should match the rules for mktemp, i.e.
> * end in "XXXXXX". The X string will be modified to form the name
> * of a file that was created and opened.
> *
> * Return value: A file handle (as from open()) to the file file
> * opened for reading and writing. The file is opened in binary mode
> * on platforms where there is a difference. The file handle should be
> * closed with close(). In case of errors, -1 is returned.
> *
> * Code lifted from glibc.
You should say "from the GNU C library. Copyright Free Software Foundation xxxx-yyyy"
or something along those lines.
Regards,
Owen
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]