#include <iostream>
#include <cstdlib>
#ifdef CCXX_NAMESPACES
using namespace std;
using namespace ost;
#endif
{
private:
void httpHeader(const char *header, const char *value)
{cout << "HEADER " << header << "=" << value << endl;}
};
int main(int argc, char **argv)
{
myURLStream url;
char cbuf[1024];
int len;
#ifdef CCXX_EXCEPTIONS
try {
#endif
while(--argc) {
++argv;
cout << "fetching " << *argv << endl;
status = url.get(*argv);
if(status) {
cout << "failed; reason=" << status << endl;
url.close();
continue;
}
cout << "loading..." << endl;
while(!url.eof()) {
url.read(cbuf, sizeof(cbuf));
len = url.gcount();
if(len > 0)
cout.write(cbuf, len);
}
url.close();
cout << ends;
}
#ifdef CCXX_EXCEPTIONS
}
catch(...) {
cerr << "url " << *argv << " failed" << endl;
}
#endif
return 0;
}