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");
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.
Create the name using the time functions from ctime
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?
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
Look up the function strftime(). You can create any string you want with it.
Wow that looks great! Thanks. Have any idea about the function question?
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;
}
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.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.