tmpnam warning saying it is dangerous

后端 未结 5 1089
醉话见心
醉话见心 2021-01-03 19:15

I get this warning saying that tmpnam is dangerous, but I would prefer to use it, since it can be used as is in Windows as well as Linux. I was wondering why it would be con

5条回答
  •  情深已故
    2021-01-03 19:44

    If you want to use the same symbol on multiple platforms, use a macro to define TMPNAM. As long as you pick more secure functions with the same interface, you'll be able to use it on both. You have conditional compilation somewhere in your code anyway, right?

提交回复
热议问题