On Wed, Jul 16, 2014 at 10:33 AM, FRIGN <d...@frign.de> wrote: > On Wed, 16 Jul 2014 10:16:17 -0400 > Lee Fallat <ircsurfe...@gmail.com> wrote: > >> I'm with koneu on this one- why make it human readable? >> >> I don't think you need to store the height either- just the width. >> Then just read until EOF and the height will be implicit. > > Well, how would we know how large the buffer should be? In case only a > width is given, you are left to guess and will be forced to realloc > very often in case it's not enough. > fseek(filehandle, 0, SEEK_END); height = (ftell(filehandle) / RGBA_CHANNEL_SIZE) / width;
Then you allocate your buffer. >> Honestly I'm surprised the header is just not [width] and nothing >> else. Sure, if the file ever gets lost in deletion space it'll never >> be recoverable, but that'll teach people not to remove files with so >> much haste :) > > I would have no problem with just having "pic" at the beginning of the > file (or any other name we might come up with). > Why, what's the purpose of this?