37 #include "OSParameters.h"
42 #include "CoinHelperFunctions.hpp"
51 # error "don't have header file for time"
60 int main(
int argC,
char* argV[])
62 WindowsErrorPopupBlocker();
64 const char dirsep = CoinFindDirSeparator();
65 std::string osilFileNameWithPath;
66 std::string osilFileName;
68 std::string uploadResult;
69 std::string actualServer;
72 std::string defaultServer =
"http://128.135.130.17:8080/os/servlet/OSFileUpload";
75 if( argC == 1 || argC > 3 || argV[1] ==
"-?")
76 throw ErrorClass(
"usage: OSFileUpload <filename> [<serverURL>]");
78 time_t start, finish, tmp;
79 osilFileNameWithPath = argV[ 1];
80 std::cout <<
"FILE NAME = " << argV[1] << std::endl;
81 std::cout <<
"Read the file into a string" << std::endl;
85 actualServer = defaultServer;
87 actualServer = argV[2];
92 int index = osilFileNameWithPath.find_last_of( dirsep);
93 int slength = osilFileNameWithPath.size();
94 osilFileName = osilFileNameWithPath.substr( index + 1, slength) ;
95 std::cout << std::endl << std::endl;
96 std::cout <<
"Place remote synchronous call" << std::endl;
99 uploadResult = osagent->
fileUpload(osilFileName, osil);
100 finish = time( &tmp);
101 std::cout <<
"File Upload took (seconds): "<< difftime(finish, start) << std::endl;
102 std::cout << uploadResult << std::endl;
104 if(fileUtil != NULL)
delete fileUtil;
108 std::cout << eclass.
errormsg << std::endl;
109 if(fileUtil != NULL)
delete fileUtil;
Used by a client to invoke a remote solver.
std::string errormsg
errormsg is the error that is causing the exception to be thrown
int main(int argc, char *argv[])
std::string fileUpload(std::string osilFileName, std::string osil)
implement the fileUpload() method which is a virtual function in OShL
std::string getFileAsString(const char *fname)
read a file and return contents as a string.
class used to make it easy to read and write files.
used for throwing exceptions.