Ok here is a very simple question:
In the following code section, the “cin.getline()” doesn’t run:
cout<< "Specify USB drive letter: ";
char usbD[1];
char outputLoc [40];
cin.getline(usbD, 1, '\n');
cout<< "\n" << usbD << "\n";
What am I doing wrong?
You need 2 spaces to store a string with a single character, this is because c++ uses a
\0to delimit the string. You can change your code as follows: