943,879 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Marked Solved
  • Views: 596
  • C++ RSS
Dec 17th, 2008
0

Unnecessary characters

Expand Post »
Hi

I am using the code to get the current date
CTime aNow = CTime::GetCurrentTime();
char month[3];
char day[3];
char year[6];
char todaysdate[30];

itoa(aNow.GetMonth(), month, 10);
itoa(aNow.GetYear(), year, 10);
itoa(aNow.GetDay(), day, 10);

strcat(todaysdate,month);

I am getting value of month but apart from that I am also getting an unexpected character "He"

so My final output is

He 12

Why this extra He is coming.

Kindly advice

Regards
Karan
Similar Threads
Reputation Points: 10
Solved Threads: 0
Light Poster
karang is offline Offline
46 posts
since Jul 2008
Dec 17th, 2008
0

Re: Unnecessary characters

try this...
char month[3] = {NULL};
etc..
Reputation Points: 47
Solved Threads: 69
Posting Whiz
cikara21 is offline Offline
340 posts
since Jul 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: C++ Help Needed
Next Thread in C++ Forum Timeline: exception handling





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC