Created
August 21, 2022 06:43
-
-
Save epshteinmatthew/299fe42c829cd692b4c730a226ba8b6c to your computer and use it in GitHub Desktop.
File thingy ulfius library
This file contains hidden or 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
| FILE *fp; | |
| fp = fopen("ykraina.jpeg", "r"); | |
| if(fseek(fp, 0L, SEEK_END) != 0){perror("seeking");return 1;}; | |
| int sz = ftell(fp); | |
| char ch[sz]; | |
| rewind(fp); | |
| fread(ch, 1,sz, (FILE *)fp); | |
| ulfius_add_header_to_response(response, "Content-Type", "image/jpeg"); | |
| ulfius_set_binary_body_response(response,200,ch,sz); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment