X-Git-Url: https://harishankar.org/repos/?p=biaweb2.git;a=blobdiff_plain;f=biawebutil.hpp;h=c8603ea106530e7cdc55e52168cc8a0d7e8827e9;hp=ee6cd5a26e4e0771524ba2e24961d1768fc4179c;hb=44d5fb1ff24147859c5f198dd47f6956ec5fea51;hpb=1d1f04629b04c7e7efd14d8f281e17f5e491c888 diff --git a/biawebutil.hpp b/biawebutil.hpp index ee6cd5a..c8603ea 100644 --- a/biawebutil.hpp +++ b/biawebutil.hpp @@ -23,16 +23,19 @@ namespace biaweb { // till a cleaner solution can be found. MMIOT *doc; doc = mkd_string (str.c_str(), str.size(), 0); - FILE *f = fopen (".biaweb.tmp", "w"); + char tempfile[20]; + strcpy (tempfile, "/tmp/biawebXXXXXX"); + int fd = mkstemp (tempfile); + FILE *f = fdopen (fd, "w"); markdown (doc, f, 0); fclose (f); - std::ifstream ftmp (".biaweb.tmp"); + std::ifstream ftmp (tempfile); std::string tmpl ( (std::istreambuf_iterator (ftmp)), (std::istreambuf_iterator ()) ); ftmp.close (); mkd_cleanup (doc); - remove (".biaweb.tmp"); + remove (tempfile); return tmpl; }