"""
#include <iostream>
#include <cstring>
using namespace std;
// Function replaces spaces with hyphens
void StrSpaceToHyphen(char modString[]) {
int i; // Loop index
for (i = 0; i < strlen(modString); ++i) {
if (modString[i] == ' ') {
modString[i] = '-';
}
}
}
int main() {
const int INPUT_STR_SIZE = 50; // Input C string size
char userStr[INPUT_STR_SIZE]; // Input C string from user
// Prompt user for input
cout << "Enter string with spaces: " << endl;
cin.getline(userStr, INPUT_STR_SIZE);
// Call function to modify user defined C string
StrSpaceToHyphen(userStr);
cout << "String with hyphens: " << userStr << endl;
return 0;
}
"""
When I tried to step in cin.getline(userStr, INPUT_STR_SIZE), in debugger console , after "Enter string with spaces: ", I entered a string "Hello there everyone.".
Then there're two error.
error : 'Hello' is not a valid command.
error: Unrecognized command 'Hello'
Everytime I enter an user input, this error ocurred. I am using Xcode 10 with c++ , and my debugger is lldb.
How can I solve this problem? Thank you!