summaryrefslogtreecommitdiffstats
path: root/test/ftell-test.c
diff options
context:
space:
mode:
authorAnton L. Šijanec <anton@sijanec.eu>2020-05-01 15:18:12 +0200
committerAnton L. Šijanec <anton@sijanec.eu>2020-05-01 15:18:12 +0200
commit6961e4237f24306ab2475f4f527a7c802134c4d9 (patch)
tree0d18e9dd78fe3dee482872a65fbf823e00cd31db /test/ftell-test.c
parentfolder structure README.mf (diff)
downloadbverbose-6961e4237f24306ab2475f4f527a7c802134c4d9.tar
bverbose-6961e4237f24306ab2475f4f527a7c802134c4d9.tar.gz
bverbose-6961e4237f24306ab2475f4f527a7c802134c4d9.tar.bz2
bverbose-6961e4237f24306ab2475f4f527a7c802134c4d9.tar.lz
bverbose-6961e4237f24306ab2475f4f527a7c802134c4d9.tar.xz
bverbose-6961e4237f24306ab2475f4f527a7c802134c4d9.tar.zst
bverbose-6961e4237f24306ab2475f4f527a7c802134c4d9.zip
Diffstat (limited to '')
-rw-r--r--test/ftell-test.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/ftell-test.c b/test/ftell-test.c
new file mode 100644
index 0000000..e0dd374
--- /dev/null
+++ b/test/ftell-test.c
@@ -0,0 +1,17 @@
+#include <stdlib.h>
+#include <stdio.h>
+
+extern int main(int argc, char* argv[]) {
+ if(argc != 2) {
+ printf("usage: %s filename-to-read\n", argv[0]);
+ return 1;
+ }
+ FILE * temp_input_file = fopen(argv[1], "r");
+ char char_buffer = fgetc(temp_input_file);
+ while(char_buffer != EOF) {
+ printf("I have character %c on position %ld\n", char_buffer, ftell(temp_input_file)-1);
+ char_buffer = fgetc(temp_input_file);
+ }
+ printf("reached EOF!\n");
+ return 0;
+}