so i have
Code:char dateStr [9]; char timeStr [9]; _strdate( dateStr); _strtime( timeStr );
I know i can transform strings into ingeters using atoi, but how do i get only the X's in XX/XX/XXXX, the question is, how do i break down the string?
so i have
Code:char dateStr [9]; char timeStr [9]; _strdate( dateStr); _strtime( timeStr );
I know i can transform strings into ingeters using atoi, but how do i get only the X's in XX/XX/XXXX, the question is, how do i break down the string?
Use a combination of strchr() and strtol() in a loop. Strtol reads up until the first non valid character (i.e non numeric) and strchr() returns a pointer to the character you are looking for, in this case '/'. Atoi() is depricated, use strtol() instead.
thanks!