Skip to content

Instantly share code, notes, and snippets.

@epshteinmatthew
Created August 21, 2022 06:43
Show Gist options
  • Select an option

  • Save epshteinmatthew/299fe42c829cd692b4c730a226ba8b6c to your computer and use it in GitHub Desktop.

Select an option

Save epshteinmatthew/299fe42c829cd692b4c730a226ba8b6c to your computer and use it in GitHub Desktop.
File thingy ulfius library
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