Skip to content

Get path for (file/temp)? #1482

Answered by sogaiu
neezer asked this question in Q&A
Aug 5, 2024 · 1 comments · 2 replies
Discussion options

You must be logged in to vote

I've also wanted automatic clean up but haven't found a nice way to accomplish it.

IIUC, the current implementation uses tmpfile:

    FILE *tmp = tmpfile();

According to tmpfile(3):

  The tmpfile() function opens a unique temporary file in binary
  read/write (w+b) mode.  The file will be automatically deleted when it
  is closed or the program terminates.

It looks to me like it's the underlying standard C library that's being relied on to provide the clean up part as the man page has this bit near the top:

LIBRARY
Standard C library (libc, -lc)

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@neezer
Comment options

@sogaiu
Comment options

Answer selected by neezer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants