-
-
Save matason/7c13c0f17a697a6cc97a to your computer and use it in GitHub Desktop.
Isolated httpfs test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <errno.h> | |
int main (int argc, char *argv[]) { | |
FILE *f; | |
FILE *ret; | |
int c; | |
f = fopen(argv[1], "rbm"); | |
if (!f) { | |
printf("%s\n", "fopen failed"); | |
exit(1); | |
} | |
printf("%s\n", "fopen success"); | |
int fd = fileno(f); | |
ret = fdopen(fd, "rb"); | |
if (!ret) { | |
printf("%s\n", "fdopen failed"); | |
exit(1); | |
} | |
printf("%s\n", "fdopen success"); | |
// At this point I a single U+FFFD character. | |
while (!feof (ret)) { | |
int c = fgetc (ret); | |
putchar(c); | |
} | |
fclose(f); | |
fclose(ret); | |
exit(0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment