made logger-test much better
it now reads content of log file
This commit is contained in:
parent
054c7647a1
commit
67170b2635
@ -19,17 +19,34 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|||||||
#include <why2.h>
|
#include <why2.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
//VARIABLES
|
//VARIABLES
|
||||||
logFile logger = initLogger(WRITE_DIR); //INITIALIZE LOGGER FILE
|
logFile logger = initLogger(WRITE_DIR); //INITIALIZE LOGGER FILE
|
||||||
|
int bufferSize;
|
||||||
printf("%d\n", logger.file);
|
char *buffer;
|
||||||
|
FILE *fileBuffer;
|
||||||
|
|
||||||
writeLog(logger.file, WRITE_MESSAGE); //WRITE
|
writeLog(logger.file, WRITE_MESSAGE); //WRITE
|
||||||
|
|
||||||
|
fileBuffer = fopen(logger.fileName, "r");
|
||||||
|
fseek(fileBuffer, 0, SEEK_END);
|
||||||
|
bufferSize = ftell(fileBuffer);
|
||||||
|
rewind(fileBuffer); //REWIND fileBuffer (NO SHIT)
|
||||||
|
|
||||||
|
//SET LENGTH OF buffer
|
||||||
|
buffer = malloc(bufferSize + 1);
|
||||||
|
|
||||||
|
//LOAD jsonFile
|
||||||
|
fread(buffer, bufferSize, 1, fileBuffer);
|
||||||
|
|
||||||
|
printf("%s\n", buffer);
|
||||||
|
|
||||||
//DEALLOCATION
|
//DEALLOCATION
|
||||||
|
free(buffer);
|
||||||
|
fclose(fileBuffer);
|
||||||
deallocateLogger(logger);
|
deallocateLogger(logger);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user