Hello, Tried to compile and run the following C code on Windows (with gcc/mingw-w64), and it crashed at the swscanf() call:
---- #define __USE_MINGW_ANSI_STDIO 1 #include <stdio.h> int main(void) { wchar_t buf[] = L"1 2 3"; wchar_t field[10]; swscanf(buf, L"%ls", field); // crash wprintf(L"%ls\n", field); return 0; } ---- This is not my original code. The original code is C++ which includes a C++ header <cstdio> which indirectly defines __USE_MINGW_ANSI_STDIO (after multiple levels of includes), so originally I didn't define this constant myself. At least the code here doesn't have C++ influences. I assumed that, if __USE_MINGW_ANSI_STDIO is defined to be 1, then the Microsoft convention of interpreting %s" is suppressed and C99 convention rules. It applies to *printf() so I assumed it applies to *scanf() as well. Instead the program crashed. The swscanf() call still crashed with different specifiers: "%s", and "%S" The compiler used were downloaded from here (5.4.0 and 6.4.0) https://sourceforge.net/projects/mingw-w64/files/Multilib%20Toolchains%28Targetting%20Win32%20and%20Win64%29/ ---- Regards, David Lee. ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public