I tried writing a function that returns just the time. It doesn't work, it gives really weird characters:
any idea whats wrong?Code:char* GetTime() { bool flag=false; time_t now; time(&now); char* time = new char[10]; char* realtime = new char[10]; strcpy(time, ctime(&now)); for(int x=0; x<10; x++) { if(!flag) { if(time[x] == ':') { wsprintf(realtime, "%c%c%c%c%c", time[x-2], time[x-1], time[x], time[x+1], time[x+2]); flag = true; } } } return realtime; }