Hey, what I am trying to do is change the way I assign a title on a dos command prompt, so basically change the title input from:

system("TITLE welcome to my page");


title("Welcome to my page");

I have tried to code it however there are errors:

void title(const char *myTitle &mode)
    system("TITLE myTitle");            

Any ideas? Thank you

8 Years
Discussion Span
Last Post by Phil++

You can't use a variable in a string like that, you have to manually add it to the string.

void title(const char *myTitle) // &mode?
   std::string command = "title ";
   command += myTitle;
   system( command.c_str() );

Also, what is the "&mode" there for?


Hey, thank you for all your replies, I got it working :)
Now, I'm creating one for a color command that enables the user to enter something like:

color("blue", "write") // blue background and white text

Like this:

void color(const char *background, char const *text)
std::string color = "color";
color += background;
color += textl
system ( color.c_str() );

However, it will only work if the user enters like 1F, so would I create an if statement something like:

if (background == 'Blue') 
    background == '1';

Kind of thing or what else could I use? Thanks :)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.