Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The following code will give you something close to what you want. If you like the solution that I provided, please mark it as correct, and upvote it. Thanks!

#include <iostream>
#include <ctime>
#include <sstream>

using namespace std;

int main(void)
{
    // http://www.tutorialspoint.com/cplusplus/cpp_date_time.htm

    time_t now = time(0);

    tm *ltm = localtime(&now);

    ostringstream oss;

    oss << "TestVideo_";
    oss << 1900 + ltm->tm_year;
    oss << 1 + ltm->tm_mon;
    oss << ltm->tm_mday;
    oss << '_';
    oss << 1 + ltm->tm_hour;
    oss << 1 + ltm->tm_min;
    oss << 1 + ltm->tm_sec;
    oss << "_x.mp4";

    cout << oss.str() << endl;

    return 0;
}