#include <iostream>
#include <cstdio>
#include <cstdlib>
int main()
{
char buffer[2] = {0, 0};
try
{
gets_s(buffer, 2);
}
catch (...)
{
}
std::cout << buffer << std::endl;
return 0;
}
// Input : 5
// Output: 5
// Note: Any input longer that one character throws a program terminating
// exception on MSVS 2017.
References:https://stackoverflow.com/questions/38405260/difference-between-c99-and-c11
http://en.cppreference.com/w/c/io/gets
No comments:
Post a Comment