Now i have this function, scriviDatabase, that takes in a tm struct and an int, reads the first char of the file and then creates a string that it writes into a file named database.txt: but whenever i run this code i get no output at all in the file database.txt, it exists and it is located in the program folder but still no output.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
void scriviDatabase(struct tm giorno,int temp) {
int pos;
char bufr;
char buf[256];
FILE *lgPos = fopen("database.txt", "r ");
if (lgPos == NULL)
{
printf("Errore! Non ho potuto trovare il database!\n");
exit(-1);
}
fread(&bufr, 1,sizeof(bufr), lgPos);
if (bufr == 10) {
bufr = '0';
}
sprintf(buf,"%c Giorno: %s %d/%d/%d Temp: