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

Last change on this file since 316 was 316, checked in by lemeur, 11 years ago

introduction softwareTest

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