Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

CBuilder & TNMHTTP Component

Posted on 1998-05-26
5
Medium Priority
?
588 Views
Last Modified: 2012-05-04
Borland CBuilder3 comes with an HTTP component by NetMasters. It works fine when I want to 'GET' a text file.
& by changing the InputFileMode between TRUE & FALSE, I have no problem in GETting the text file either as a saved file or as an Ansi-String. My problem start when I want to GET an image, ie: BMP,GIF or JPG. The SendHeader request appears OK for binary images, (TNMHTTP->SendHeader->Text;), however depending on InputFileMode I either GET an empty file or an Error Message stating that GET failed. I'm at a loss to guess what else to try.
Thanks Hugh.
0
Comment
Question by:Matlock
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 2

Expert Comment

by:JensUniweb
ID: 1164720
I don't want to dissapoint you, but when I look at the nmhttp.hpp I see that it uses AnsiStrings everywhere. So it may be that this component can not handle binary data. I'll check this later today.
0
 

Author Comment

by:Matlock
ID: 1164721
The AnsiStrings in the .hpp file are all to do with names of locations and files / commands. So I don't believe that this actually relates to how binary data is handled. Hugh
0
 
LVL 2

Expert Comment

by:JensUniweb
ID: 1164722
The body and header of the returned data is put in the header and body varbles. And they are AnsiStrings. I have not had time to investigate if there is away to receive binary data anyway.
0
 
LVL 2

Accepted Solution

by:
JensUniweb earned 400 total points
ID: 1164723
I've tried this some more now. I don't get InputFileType = true to work as I expect it to do after reading the documentation. But when you use InputFileType = false you can save the data to file or copy it to memory by using Body.c_str() and BytesTotal. I saved it to file with these two rows.

    ofstream tX( "x.x",ios_base::binary|ios_base::out );
    tX.write( NMHTTP1->Body.c_str(),NMHTTP1->BytesTotal );

NMHTTP1 is the HTTP component. This way I could get pictures and other binary data.

But anyway I think this component does not work as it should one way could be to contact Inprise(Borland). But I think that they will ask you to talk with NetMaster L.L.C. And to get support from them you may have to buy it. I don't know this yet because I've not tried it yet.
0
 

Author Comment

by:Matlock
ID: 1164724
HI! That's great, I'm sure you're right that it doesn't work correctly but anyway thanks for pointing me in the RIGHT direction I can now at least GET binary data Thanks
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question