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
The function is dangerous, because you are responsible for allocating a buffer that will be big enough to handle the string that tmpnam()
is going to write into that buffer. If you allocate a buffer that is too small, tmpnam()
has no way of knowing that, and will overrun the buffer (Causing havoc). tmpnam_s()
(MS's secure version) requires you to pass the length of the buffer, so tmpnam_s
know when to stop.