Quella funzione è concettualmente errata.
Per la questione di appendere un carattere ad un stringa c'è anche un'altra soluzione qui :codice:#include <stdio.h> #include <string.h> #include <time.h> void GetTimeStr(char *str) { time_t rawtime; struct tm *timeinfo; time ( &rawtime ); timeinfo = localtime ( &rawtime ); strcpy( str,asctime (timeinfo)); } int main( void ) { char str[50]; GetTimeStr(str); printf("str = %s\n\n", str); /* ------------------ */ char str1[20]="Ciao"; char ch[2]="\0\0"; ch[0] = 0x21; // char ch[2]={0x21, 0}; // Netodo alternativo printf("str = %s\n\n", str1); strcat( str1, ch); printf("str = %s\n\n", str1); getchar(); return 0; }
http://forum.html.it/forum/showthrea...6#post12176296