getenv() may be unsafe?
Posted: February 26th, 2017, 3:51 am
Hello,
I'm trying to get file i/o working so I can store my game's top score in appdata. So I use getenv("appdata") in order to do that. But visual studio gives me a warning saying that getenv may be unsafe and that I should use _dupenv_s instead.
Now I tried looking around for how to use the function but I don't think I understand it.
https://msdn.microsoft.com/en-us/library/ms175774.aspx
I guess I need to give it a buffer? Then free the buffer?
It also takes in size? What is this sorcery?
http://stackoverflow.com/questions/1591 ... f-dupenv-s
Can someone explain / give an example how I can do this properly?
I'm trying to get file i/o working so I can store my game's top score in appdata. So I use getenv("appdata") in order to do that. But visual studio gives me a warning saying that getenv may be unsafe and that I should use _dupenv_s instead.
Now I tried looking around for how to use the function but I don't think I understand it.
https://msdn.microsoft.com/en-us/library/ms175774.aspx
I guess I need to give it a buffer? Then free the buffer?
It also takes in size? What is this sorcery?
http://stackoverflow.com/questions/1591 ... f-dupenv-s
Can someone explain / give an example how I can do this properly?