1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
void getLogDeletesMessages(int(*freply)(unsigned char *, int))
{
FILE* flog;
char ligne[MAX_LINE];
char filename[80];
char * p =NULL;
char dest[80];
struct tm * pdh;
time_t intps;
intps = time(NULL);
pdh = localtime(&intps);
strftime(dest, 80, "%Y-%m-%d", pdh);
strcpy(filename, dest);
strcat(filename, ".chatserv.txt");
if ((flog= fopen(filename, "r")) != NULL)
{
while(fgets(ligne, MAX_LINE, flog))
{
if ((ligne[0] != '\r') && (ligne[0] != '\n') ) {
p = strchr(ligne, '\n');
if (p)
{
*p = 0;
}
CharToOem(ligne,ligne);
if (strstr(ligne, "deletes message") != NULL)
{
(*freply)((unsigned char *)ligne, (int)strlen(ligne));
}
}
}
fclose(flog);
} else debugLogParam("impossible d'acceder au fichier", filename);
} |
Partager