On July 16, 2014 5:05:01 PM CEST, Markus Teich <markus.te...@stusta.mhn.de> wrote: >Lee Fallat wrote: >> fseek(filehandle, 0, SEEK_END); >> height = (ftell(filehandle) / RGBA_CHANNEL_SIZE) / width; >> >> Then you allocate your buffer. > >Heyho Lee, > >This needs FILE* instead of just a file descriptor, making usage in >pipes >intractable. > >--Markus
fstat() works on file descriptors and you can use it on stdin even if it is a pipe. Still, storing width _and_ height in the header won't really hurt.