X-Git-Url: https://git.sesse.net/?p=cubemap;a=blobdiff_plain;f=util.h;fp=util.h;h=f64e25795d5dec79b662519f6a4d319be0f9562d;hp=0000000000000000000000000000000000000000;hb=7ddd07eb95bb3216fad47aa6d3eb76a8b2648579;hpb=3fdf2e48bca3edcb0de00e0dbd0d0aae81ba9aa9 diff --git a/util.h b/util.h new file mode 100644 index 0000000..f64e257 --- /dev/null +++ b/util.h @@ -0,0 +1,15 @@ +#ifndef _UTIL_H +#define _UTIL_H + +// Some utilities for reading and writing to temporary files. + +#include + +// Make a file in /tmp, unlink it, and write to it. +// Returns the opened file descriptor, or -1 on failure. +int make_tempfile(const std::string &contents); + +// Opposite of make_tempfile(). Returns false on failure. +bool read_tempfile(int fd, std::string *contents); + +#endif // !defined(_UTIL_H