aboutsummaryrefslogtreecommitdiff
path: root/tmp/api-posix.c
blob: 9f51967bc667bc1d96ba2ed65bdea6c9e752e551 (about) (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/* POSIX implementation of "api.h" interface to be used in non-web contexts */

#include <stdio.h>

void platformDependentPersistInt(int n) {
  FILE* fp = fopen("/tmp/persisted.txt", "w+");
  fprintf(fp, "%d", n);
  fclose(fp);
}

int platformDependentRetrieveInt() {
  FILE* fp = fopen("/tmp/persisted.txt", "r");
  int persisted = fgetc(fp);
  return persisted;
}