Microsoft has deprecated _open in favor of _sopen_s. What are the recommended equivalent arguments?
Well now I can post my nicely formatted answer, so here it is:
For
int fd = _open(name,oflags);
Replace with
int fd;
errno_t errno = _sopen_s(&fd,name,oflags,_SH_DENYNO,0);
The reason I posted this Q&A is that it provides an important bit of non-obvious info that Microsoft didn't provide. I agree that the _sopen_s is a poor replacement for _open. I only researched this topic because I was fixing a bug caused by the wrong arguments being supplied to _sopen_s. The _sopen_s was only in the code to get rid of the compiler warnings; the original _open call was fine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With