c++ - strftime adds unwanted characters to what I'm trying to display -
hey guys i'm wondering if can point out me. i'm trying display date & time in right hand corner of cmd prompt i'm getting additional characters i'm asking for. have far
time_t rawtime; struct tm * timeinfo; char buffer[80]; time(&rawtime); timeinfo = localtime(&rawtime); // displays "23 date:etcetcetc" cout << "\n\n\n\n\n\n\n\n\n\n\n\n"; cout << strftime(buffer, 80, "\t\t\t\t\t\t\tdate: %d/%m/%y", timeinfo); puts(buffer); // , displays "16time:etcetcetc" cout << "\t\t\t\t\t\t\t"; cout << strftime(buffer, 80,"time: %i:%m:%s \n", timeinfo);; puts(buffer);
if can see comments gives me want adds 23 first line , 16 other, doing wrong?
kind regards!
jb
try replace this:
cout << strftime(buffer, 80, "\t\t\t\t\t\t\tdate: %d/%m/%y", timeinfo);
with this:
strftime(buffer, 80, "\t\t\t\t\t\t\tdate: %d/%m/%y", timeinfo);
Comments
Post a Comment