Re: m_HttpResponse does not show image using rdbuf()
- From: "Igor Tandetnik" <itandetnik@xxxxxxxx>
- Date: Tue, 16 Dec 2008 07:36:26 -0500
"Jeff Dunlap" <JeffDunlap@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:A80FCD68-0BCE-4504-B1ED-D561E8E5A736@xxxxxxxxxxxxx
// using rdbuf() does not work for some unknown reason:
m_HttpResponse.WriteStream((LPCSTR)is.rdbuf(), length, NULL);
How on earth do you expect this to work? Why do you believe it's OK to
cast filebuf* to char*?
You are sending contents of some random memory block to the client. You
haven't read a single byte of data from the actual file yet.
If you just want to send contents of a file on disk as is, see
CHttpResponse::TransmitFile.
Alternatively, if I create read the data into a buffer like this it
works:
Well, duh.
Is it possible to display the image using rdbuf()
No.
--
With best wishes,
Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925
.
- Follow-Ups:
- Re: m_HttpResponse does not show image using rdbuf()
- From: Jeff Dunlap
- Re: m_HttpResponse does not show image using rdbuf()
- Prev by Date: VC6 to VC9 Migration problem
- Next by Date: Re: m_HttpResponse does not show image using rdbuf()
- Previous by thread: VC6 to VC9 Migration problem
- Next by thread: Re: m_HttpResponse does not show image using rdbuf()
- Index(es):
Relevant Pages
|