Can I use scanf_s in CLion?
Answered
I am trying to learn the C programming language and some code that I found used scanf_s,but it doesn't compile with CLion.
The code below compiles fine in VS2015, but doesn't link in CLion on OS X
#include <stdio.h>
int main() {
printf("Hello, World!\n");
int myAge = 0;
printf("How old are you?\n");
scanf_s("%d", &myAge);
printf("You said you are %d years old.\n", myAge);
return 0;
}
Please sign in to leave a comment.
scanf_s is a Microsoft-specific function, so it is currently unavailable in CLion since it supports only MinGW/cygwin toolchains. We plan to support MSVC toolchain in the next release. Please use scanf instead.
Thank you Anna!
Glad to hear that MSVC support is coming.
I thought that since it was listed on cppreference.com it was part of the C11 standard.
I'll look forward to the next release and replace scanf_s with scanf.