Código:
#include <iostream> using namespace std; #include <ctime> #include <stdio.h> int main(void) { int a = 1; /* Optener System Time Date*/ cout<< "System Time Date:" <<endl; cout<< " " <<endl; time_t tSac = time(NULL); // instante actual struct tm* tmP = localtime(&tSac); int hour = tmP->tm_hour; int min = tmP->tm_min; int day = tmP->tm_mday; int mon = tmP->tm_mon+1; int year = tmP->tm_year+1900; cout << "Time: " << hour << ":" << min << endl; cout << "Date: " << day << "-" << mon << "-" << year << endl; /* Raname */ cout<< "-------------------------------------------------" <<endl; cout<< " " <<endl; cout<< "Renombrar Archivo" <<endl; cout<< " " <<endl; int result; char oldname[] = "old.txt"; char newname[] = "new.txt"; result = rename( oldname , newname ); if ( result == 0 ) puts ( "File successfully renamed" ); else perror( "Error renaming file" ); cin >> a; };