Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22042

Strange character at the beginning of logging - C

$
0
0

I am trying to log whenever a user does something into a log file, with the date included, however when I do this, at the beginning of each log, I get a strange symbol.

        char log[200];
        char datetime[200];
        time_t now = time(NULL);
        strftime(datetime,200,"%x %X", localtime(&now));
        strcat(log,datetime);
        sendline[strlen(sendline)-1] = 0;
        strncat(log," - ",3);
        strcat(log,sendline);
        recvline[strlen(recvline)-1] = 0;
        strncat(log," - ",3);
        strcat(log,recvline);
        strncat(log,"\n",1);
        fprintf(fp,"%s",log);

This is the symbol I am getting with each entry

This is the symbol I am getting with each entry

How can I solve this and why is it happening?


Viewing all articles
Browse latest Browse all 22042

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>