source: PSPA/Interface_Web/trunk/pspaWT/sources/controler/src/abstractSoftware.cc @ 342

Last change on this file since 342 was 342, checked in by touze, 11 years ago

nvx element snapshot

File size: 897 bytes
Line 
1#include "abstractSoftware.h"
2#include "dataManager.h"
3
4abstractSoftware::abstractSoftware()
5{
6  globParamPtr_ = NULL;
7  dataManager_ = NULL;
8}
9
10abstractSoftware::abstractSoftware(string inputFileName, globalParameters* globals, dataManager* dt) {
11  inputFileName_ = inputFileName;
12  globParamPtr_ = globals;
13  dataManager_ = dt;
14}
15
16
17bool abstractSoftware::launchJob(string commandLine, string& resul)
18{
19  bool ExecuteStatus = true;
20
21  FILE* pp = popen(commandLine.c_str(), "r");
22  ostringstream sortie;
23  if (pp == NULL) {
24    sortie << " launching  failed : " << commandLine << endl;
25    ExecuteStatus = false;
26  } else {
27    cout << " executing command :  "  << commandLine << endl;
28    // on copie la sortie dans le fichier assigne
29    char buf[132];
30    while (fgets(buf, sizeof buf, pp))
31      {
32        sortie << buf;
33      }
34    pclose(pp);
35  }
36  resul =  sortie.str();
37  return ExecuteStatus;
38}
Note: See TracBrowser for help on using the repository browser.