For c++, which include file is needed to use the fscanf_s function?

0 votes
asked Jun 25 by srh (120 points)
Also, which version of C++ does fscanf_s work in? (C++, C++11, C++17?)

1 Answer

0 votes
answered Jun 25 by Peter Minarik (7,260 points)
edited Jun 26 by Peter Minarik

Please, read the documentation:

As you see, fscanf is declared in the <cstdio> (in C++, or stdio.h for C) header.

fscan_s is not part of the standard. It's implemented by Microsoft (see documentation) so OnlineGDB doesn't recognise it.

Therefore, the second part of the question (which C++ supports it) is invalid, as, again, the standard does not support it, it's only available on Microsoft operating systems. (OnlineGDB is not one of them.) Specifically on Microsoft platform, I'd assume, all C++ versions would support it, but again, only on their platforms.

commented Jun 25 by srh (120 points)
Makes sense...I didn't know it was Microsoft specific...just what I needed to know...Thanks.
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.