From: Bastian Dehn Date: Mon, 9 Dec 2024 17:45:10 +0000 (+0100) Subject: add read saldo out memory stream X-Git-Tag: 1.3.2^2~1^2 X-Git-Url: https://gitweb.hhaalo.de/?a=commitdiff_plain;h=51a4ec0fa2339041685efecf11d17b2541880c91;p=feierabend.git add read saldo out memory stream --- diff --git a/src/xml.c b/src/xml.c index c9f71f3..af5b897 100644 --- a/src/xml.c +++ b/src/xml.c @@ -322,13 +322,13 @@ void createEntry(int begin_hour, xmlWriter = NULL; } -void readLastSaldo(const char* file_path, char* value) +void readLastSaldo(memFile* mem, char* value) { xmlInitParser(); - xmlDocPtr xmldoc = xmlReadFile(file_path, "UTF-8", 0); + xmlDocPtr xmldoc = xmlReadMemory(*mem->data, *mem->size, NULL, "UTF-8", 0); if (xmldoc == NULL) { - printf("ERROR: could not open file: %s\n", file_path); + printf("ERROR: could not open memstream\n"); exit(EXIT_FAILURE); } @@ -400,7 +400,7 @@ void addEntry(const char* date, char* saldostr = malloc(sizeof(char) * MAX_STRING_LENGTH); memset(saldostr, 0, MAX_STRING_LENGTH); - readLastSaldo(file_path, saldostr); + readLastSaldo(fileContent, saldostr); xmlChar* xmlElemContent = NULL; xmlTextWriterPtr xmlwriter = xmlNewTextWriterFilename("/dev/stdout", 0);