00001
00002
00003
00004
00005
00006
00007
00008 #include "XmlRpc.h"
00009 #include <iostream>
00010 #include <fstream>
00011 #include <stdlib.h>
00012
00013 using namespace XmlRpc;
00014
00015 int main(int argc, char* argv[])
00016 {
00017 if (argc != 4) {
00018 std::cerr << "Usage: TestBase64Client serverHost serverPort outputFile\n";
00019 return -1;
00020 }
00021 int port = atoi(argv[2]);
00022
00023
00024 XmlRpcClient c(argv[1], port);
00025
00026 XmlRpcValue noArgs, result;
00027 if (c.execute("TestBase64", noArgs, result))
00028 {
00029 const XmlRpcValue::BinaryData& data = result;
00030 std::ofstream outfile(argv[3], std::ios::binary | std::ios::trunc);
00031 if (outfile.fail())
00032 std::cerr << "Error opening " << argv[3] << " for output.\n";
00033 else
00034 {
00035 int n = int(data.size());
00036 for (int i=0; i<n; ++i)
00037 outfile << data[i];
00038 }
00039 }
00040 else
00041 std::cout << "Error calling 'TestBase64'\n\n";
00042
00043 return 0;
00044 }
00045