From b677d3bb3d6c8fbb0b61621cc8ac53a7d68fa949 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 12 Feb 2020 09:04:53 -0300 Subject: wip --- tmp/api-posix.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 tmp/api-posix.c (limited to 'tmp/api-posix.c') diff --git a/tmp/api-posix.c b/tmp/api-posix.c new file mode 100644 index 0000000..9f51967 --- /dev/null +++ b/tmp/api-posix.c @@ -0,0 +1,15 @@ +/* POSIX implementation of "api.h" interface to be used in non-web contexts */ + +#include + +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; +} -- cgit v1.2.3