JPEG Thumbnailer

Andre Gemünd scroogie at
Mon Aug 18 18:07:37 BST 2008

Michael Pyne schrieb:
> Actually it's easier than that:
> On an opened QFile you can use QFile::handle() to return the file 
> descriptor (i.e. what is passed to write(2)). Using the file 
> descriptior you can use the C stdio fdopen() function to return a 
> FILE* tied to that file descriptor.
> This way you can still use stdio functions on a file managed by QFile.
> All that this would really buy you is guaranteeing that the file gets 
> closed, which may not be worth the overhead however if you're simply 
> going to be passing the FILE* to libjpeg.
> Regards,
Hi Michael,
thanks a lot for you explanation. As I said, I'm not very experienced 
with Qt/KDE programming yet, so your input is very appreciated.
How much overhead are we talking about? We are opening all jpeg files of 
a directory which can be a lot at times, and apply a not-so-costly 
operation, so we should take this into consideration. And you are right, 
I just pass the FILE* to libjpeg and close it after 
jpeg_finish_decompress(), so it doesn't seem very sensible to open it 
twice (QFile and fdopen).


More information about the kde-core-devel mailing list