strcpy_s does not return properly, and further code is not executed

Viewed 85

Can someone explain why this only prints out Hello World1, and then hangs for 1 second before coming back to the command prompt, without printing anything else?

#include <iostream>
#include <cstddef>

using namespace std;
int main()
{
    char    tchar[4];
    cout << "Hello World1\n";
    strcpy_s(tchar, sizeof(tchar), "Dick");
    cout << "Hello World2\n";
    cout << tchar << "\n";
    cout << "Hello World3\n";
}
0 Answers
Related