If you're trying to learn c++ then you really should wean yourself off of using char* to represent strings, #include<string> and use an std::string, and this would include stopping using functions like puts, and instead using std::cout << "Boo!"
If on the other hand you want a C solution, I'm not your man I'm afraid