mktemp

Suppress warning: the use of `mktemp' is dangerous

会有一股神秘感。 提交于 2019-12-01 16:59:05
How can I suppress following warning from gcc linker: warning: the use of 'mktemp' is dangerous, better use 'mkstemp' I do know that it's better to use mkstemp() but for some reason I have to use mktemp() function. I guess you need the path because you pass it to a library that only accepts path names as argument and not file descriptors or FILE pointers. If so you can create a temp dir with mkdtemp and place your file there, the actual name is then unimportant because the path is already unique because of the directory. If you have to use mktemp then there is not anything you can do to

Suppress warning: the use of `mktemp' is dangerous

对着背影说爱祢 提交于 2019-12-01 15:23:34
问题 How can I suppress following warning from gcc linker: warning: the use of 'mktemp' is dangerous, better use 'mkstemp' I do know that it's better to use mkstemp() but for some reason I have to use mktemp() function. 回答1: I guess you need the path because you pass it to a library that only accepts path names as argument and not file descriptors or FILE pointers. If so you can create a temp dir with mkdtemp and place your file there, the actual name is then unimportant because the path is