1
0

tmpfile 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. .TH TMPFILE 2
  2. .SH NAME
  3. tmpfile, tmpnam \- Stdio temporary files
  4. .SH SYNOPSIS
  5. .B #include <stdio.h>
  6. .PP
  7. .ta \w'\fLFILE 'u
  8. .B
  9. FILE *tmpfile(void)
  10. .PP
  11. .B
  12. char *tmpnam(char *s)
  13. .SH DESCRIPTION
  14. .I Tmpfile
  15. creates a temporary file that will automatically
  16. be removed when the file is closed or the program exits.
  17. The return value is a Stdio
  18. .B FILE*
  19. opened in update mode (see
  20. .IR fopen (2)).
  21. .PP
  22. .I Tmpnam
  23. generates a string that is a valid file name and that is not
  24. the same as the name of an existing file.
  25. If
  26. .I s
  27. is zero, it returns a pointer to a string which may be overwritten by
  28. subsequent calls to
  29. .IR tmpnam .
  30. If
  31. .I s
  32. is non-zero, it should point to an array of at least
  33. .B L_tmpnam
  34. (defined in
  35. .BR <stdio.h> )
  36. characters, and the answer will be copied there.
  37. .SH FILES
  38. .TF /tmp/tf000000000000
  39. .TP
  40. .B /tmp/tf000000000000
  41. template for
  42. .I tmpfile
  43. file names.
  44. .TP
  45. .B /tmp/tn000000000000
  46. template for
  47. .I tmpnam
  48. file names.
  49. .SH SOURCE
  50. .B /sys/src/libstdio
  51. .SH BUGS
  52. The files created by
  53. .I tmpfile
  54. are not removed until
  55. .IR exits (2)
  56. is executed; in particular, they are not removed on
  57. .I fclose
  58. or if the program terminates abnormally.