Reputation: 504
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;
}
Upvotes: 1
Views: 1038
Reputation: 15576
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.
Upvotes: 3