// Function saves alarm to file int save_alarm(alarm *pAl) { FILE *pFile; // FILE pointer char *pbuff; pFile = fopen("Data/alarms.txt", "w"); // create/open file pthread_mutex_lock(&work_mutex); // lock access to array if (pFile != NULL) { pbuff = malloc(50); sprintf(pbuff, "%s %s %s %02d %02d %d %02d %02d 00", pAl->alarm_name, pAl->type, pAl->status, pAl->day, pAl->month, pAl->year, pAl->hour, pAl->minute ); fputs(pbuff, pFile); free(pbuff); fclose(pFile); ...