#include <iostream> #include <string> #include <string.h> using namespace std; int main() { cout << "enter a line of text: "; string userinput; getline (cin, userinput); char copyinput[20] = { '\0' }; if (userinput.length() < 20) { strcpy(copyinput, userinput.c_str()) cout << "this does not exceed the buffer"; } else { cout << "this exceeds the buffer!"; } return 0; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)