[aspect-devel] Writing output in parallel
Timo Heister
heister at math.tamu.edu
Tue Feb 28 11:06:39 PST 2012
> I do have a problem here, though: all functions like tmpname,
> tempnam, mktemp etc are marked as "do not use this function" and
> produce a linker warning. The only one one should use is mkstemp
> but this function creates a file handle that points to a file that
> is destroyed upon closing the file handle. How am I supposed to
> copy this file around then if it gets deleted right away?
several options:
1. We could let the user specify a directory and just create the files
as solution-... and hope it doesn't conflict with other files.
2. flush() the file, then copy, then fclose() it. (not sure how well that works)
3. trick mkstemp:
char template[] = "/tmp/fileXXXXXX";
int fd = mkstemp(template);
fclose(fd);
//now create the file <template>
--
Timo Heister
http://www.math.tamu.edu/~heister/
More information about the Aspect-devel
mailing list