diff options
author | EuAndreh <eu@euandre.org> | 2020-02-12 09:04:53 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2020-02-12 09:04:53 -0300 |
commit | b677d3bb3d6c8fbb0b61621cc8ac53a7d68fa949 (patch) | |
tree | a3d61cd41fbbc1fa1196f6e4bdcb76c549a3f532 /tmp/api-posix.c | |
parent | Sort pastebins listing by date (diff) | |
download | euandre.org-b677d3bb3d6c8fbb0b61621cc8ac53a7d68fa949.tar.gz euandre.org-b677d3bb3d6c8fbb0b61621cc8ac53a7d68fa949.tar.xz |
wip
Diffstat (limited to 'tmp/api-posix.c')
-rw-r--r-- | tmp/api-posix.c | 15 |
1 files changed, 15 insertions, 0 deletions
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 <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; +} |