Re: problems with HTLoadToFile
Sam Varshavchik <[email protected]> Thu, 27 Sep 2007 21:44:32 -0400
| Newsgroups | gmane.comp.lib.libwww |
|---|---|
| Message-ID | <[email protected]> |
This is a MIME GnuPG-signed message. If you see this text, it means that your E-mail or Usenet software does not support MIME signed messages. The Internet standard for MIME PGP messages, RFC 2015, was published in 1996. To open this message correctly you will need to install E-mail or Usenet software that supports modern Internet standards. --=_mimegpg-commodore.email-scan.com-11486-1190943872-0003 Content-Type: text/plain; format=flowed; charset="US-ASCII" Content-Disposition: inline Content-Transfer-Encoding: 7bit Vitaliy Yunikov writes: > > I just started working with libwww and I have a question concerning file > download. To download a file I use HTLoadToFile function, and I want > to run it in separate thread. I also want to have possibility to stop > the download by user request. I've read a lot of libwww docs and I've > seen a lot of examples, but I still don't know how to do this. > > So, is there some API to stop download after it is started? HTLoadToFile is just a single-purpose convenience function that quickly dumps a URL to a file. That's it. No frills. Just a straightforward content grab. The only way to do what you need to do is to manually construct an HTRequest object, create your own subclass of HTStreamClass, then use HTLoadToStream(), and, in your own stream's putc/puts/putblock callback, dump the data to your file. If your callback function returns HT_ERR instead of HT_OK, libwww should abort and unwind everything. You can look at some sample code here: http://lpmtool.cvs.sourceforge.net/lpmtool/lpm/www/wwwfuncs.C?view=markup --=_mimegpg-commodore.email-scan.com-11486-1190943872-0003 Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (GNU/Linux) iD8DBQBG/FyAx9p3GYHlUOIRAg5gAJwIs2ULdg2z3N24kV6ZeEqxWJ/V+ACePVLf FA8lL5TyeZ4LleXbrtgv7fM= =WUD5 -----END PGP SIGNATURE----- --=_mimegpg-commodore.email-scan.com-11486-1190943872-0003--