Search code examples
cmingw-w64

Does mingw do some posix implementations?


I installed mingw on linux and tried compiling a code for windows, this code is intended for posix systems, because I use the% m converter, but realize that when using the _POSIX_C_SOURCE 200112L macro, I can use the converter, so mingw provides a library C that supports the posix pattern?

#define _POSIX_C_SOURCE 200112L
#include <stdio.h>

int main(void){
    char *a;  
    scanf("%ms", &a);
    puts(a);
    return 0;
}

Solution

  • MinGW supports a subset of POSIX-like features (%ms, alarm, signal, etc.) on top of MSVCRT, but it's not POSIX-compliant. If you need a POSIX-compliant environment on Windows, use Cygwin.