I use function ascitime in C
#include <time.h>
char *asctime(const struct tm *timeptr);
returns something like:
Sun Sep 16 01:03:52 1973\n\0
It returns this “string”(resp. char *):
Sun Sep 16 01:03:52 1973\n\0
How can I rid of “\n” from this string? I don’t want nextline which cause “\n”.
Thx
The other answers seem overcomplicated. Your case is simple because you know the unwanted character is the last one in the string.
This nulls the last character (the \n).