My program is able to create the folder fine but I wanted to know if there is a way to put the date and time in the title? C++ and using Visual Studio 2008 for Windows.

system("mkdir %SYSTEMDRIVE%\\Blebble\\Blabble");

You want to put the date and time in the title of the window that pops up, or do you want the name of the directory to contain the date and/or time?

For getting the date/time into a string, you might look at strftime() and you should probably also consider calling mkdir() instead of system("mkdir ...") to create the directory.

Comments
Nice

Well, I have multiple folders being created by different functions depending on what is selected from the menu. Would I be able to create differently named folders with the time function?

Can't you just concatenate the desired name string and the date string?

Edited 6 Years Ago by HealBrains: n/a

Well, I have multiple folders being created by different functions depending on what is selected from the menu. Would I be able to create differently named folders with the time function?

You can create any names you want. You are in complete control of the code and what each name contains.

Do you think you could give me an example of a function that pulls the date and returns it for another function to write to the folder name?

Also, I am having a hard time remembering how to make so I can use a function that is further down the program. Instead of it saying it is undefined

Also, I am having a hard time remembering how to make so I can use a function that is further down the program. Instead of it saying it is undefined

You need the function prototype prior to its usage and the function definition later on.

// The prototype
int some_func();

int main()
{
  int xyz = some_func();
...
}
// The definition
int some_func()
{
  return 42;
}

Edited 6 Years Ago by mitrmkar: n/a

You need the function prototype prior to its usage and the function definition later on.

// The prototype
int some_func();

int main()
{
  int xyz = some_func();
...
}
// The definition
int some_func()
{
  return 42;
}

Thanks! I couldn't remember that for the life of me.

This article has been dead for over six months. Start a new discussion instead.