Hello!
It would be great if someone could help me with this problem.
Code:
#define MAX_ELEMENTS 1000
#define MAX_ELEMENTS_TIME 40
time_t rawtime;
struct tm* time_info;
char buffer_filedate[MAX_ELEMENTS_TIME];
time(&rawtime);
time_info = localtime(&rawtime);
int number_of_char;
number_of_char = strftime(buffer_filedate,MAX_ELEMENTS_TIME,"%d.%B%Y/%H:%M_Uhr", time_info);
The prog works fine. But as soon as "buffer_filedate"
Code:
console_output_string = (char *) realloc(console_output_string, (sizeof(console_output_string)+sizeof(buffer_filedate)));
strcat(console_output_string,buffer_filedate);
is attached to an array dynamically the compiler tells me: "realloc(): invalid next size"
If i change strftime() format, for example to:
Code:
number_of_char = strftime(buffer_filedate,MAX_ELEMENTS_TIME,"%d.%B%Y/%H:%M", time_info);
everything works fine.
I did not read anything, that this minimal difference (Line 11 of first code-snippet vs Line1 of the third code-snippet) in the function strftime() could be invalid.
Sorry for my bad english. I try my best to get better!!