/
vadimka
/
SimpleGeneticAlgorithm
Обзор
Документация
Войти
/
vadimka
/
SimpleGeneticAlgorithm
Код
Запросы
0
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
logger.c
25 строк
667 B
Vadim Kaluga
add panmixia
17 фев 2024, 11:09
17 фев 2024, 11:09
aae2579
Код
Авторство
О чём код?
#include <stdio.h> #include <stdarg.h> #include <string.h> /* Логгирование как в файл, если path != NULL, так и в консоль */ void logg(const char *path, const char *format, ...) { va_list args; FILE *temp; /* логгирование в файл */ if (path != NULL) { if ((temp = fopen(path, "a")) != NULL) { va_start(args, format); vfprintf(temp, format, args); va_end(args); fclose(temp); } } memset(args, 0, sizeof(args)); /* на всякий случай */ va_start(args, format); vprintf(format, args); va_end(args); }