c - How to change date string to other date string -


I have to modify the program, but I have very limited knowledge of C programming. How can I change the input string '3.10.2014' in output string '2014-10-03'?

  char * in = '3.10.2014' four * out = some (* in)  

thanks

Change the call first:

  four dates [] = "3.10.2014"; CHANGE_DATE (date);  

This creates a date in an array that you can actually modify, because unlike a string you can not do.

Pre> zero changes_date (char * s) {int y, m, d; If (sscanf (s, "% d.% D.% D", & amp; d, & amp; m, & y) == 3) {sprintf (s, "% d-% d-% d ", Y, m, d); }}

use the above not % 04d to format the year, the probability of less than expected Available buffer space is too small when available.

It would also be better to accept the size_t s_max argument and use snprintf () , and a return value. I chose briefly.


Comments

Popular posts from this blog

winforms - C# Form - Property Change -

javascript - amcharts makechart not working -

java - Algorithm negotiation fail SSH in Jenkins -