Загрузка данных


#include <stdio.h>
#include <time.h>

#include "print_module.h"

char print_char(char ch) {
    putchar(ch);
    return ch;
}

void print_log(char (*print)(char), char *message) {
    time_t raw_time;
    struct tm *time_info;
    char time_str[9];
    const char *prefix = Log_prefix;
    int i = 0;

    time(&raw_time);
    time_info = localtime(&raw_time);
    strftime(time_str, sizeof(time_str), "%H:%M:%S", time_info);

    while (prefix[i] != '\0') {
        print(prefix[i]);
        i++;
    }

    print(' ');

    i = 0;
    while (time_str[i] != '\0') {
        print(time_str[i]);
        i++;
    }

    print(' ');

    i = 0;
    while (message[i] != '\0') {
        print(message[i]);
        i++;
    }
}