https://bugs.winehq.org/show_bug.cgi?id=51846
Bug ID: 51846 Summary: Standard library call fopen(..., "wx") not recognized - causes destruction of data Product: Wine Version: unspecified Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: msvcrt Assignee: wine-bugs@winehq.org Reporter: ted@lyncon.se Distribution: ---
Created attachment 70740 --> https://bugs.winehq.org/attachment.cgi?id=70740 open_excl.cpp
wine-6.16 (Staging)
When running a program that uses the standard (since C11 and C++17) fopen() mode "wx" to guarantee that opening a file for writing fails if it already exists, I noticed that wine can't handle that mode. Instead, it prints "0104:err:msvcrt:msvcrt_get_flags incorrect mode flag: x" and successfully opens the file - even if it already exists - which destroys the content of the existing file.
I'm attaching the source code to a small C++17 program that works as expected when compiled with Visual Studio 2019 (/std:c++17) and running it on Windows 10 natively.