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");

to:

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

Windows Console stuff(wincon.h) SetConsoleTitle("name");

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 :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.