Last change
on this file since 496 was
493,
checked in by lemeur, 10 years ago
|
refection generale des secteurs et applications de softwares (suite)
|
File size:
1.3 KB
|
Line | |
---|
1 | #include "abstractSoftware.h" |
---|
2 | #include "dataManager.h" |
---|
3 | #include <algorithm> |
---|
4 | #include <iostream> |
---|
5 | |
---|
6 | abstractSoftware::abstractSoftware() |
---|
7 | { |
---|
8 | dataManager_ = NULL; |
---|
9 | nameOfSoftware_ = new nomDeLogiciel("unknownSoftware"); |
---|
10 | } |
---|
11 | |
---|
12 | // abstractSoftware::abstractSoftware(string inputFileName, sectionToExecute* sect, dataManager* data) |
---|
13 | // { |
---|
14 | // inputFileName_ = inputFileName; |
---|
15 | // // sectionToExecute_ = sect; |
---|
16 | // compBlock_ = NULL; |
---|
17 | // dataManager_ = data; |
---|
18 | // nameOfSoftware_ = new nomDeLogiciel("unknownSoftware"); |
---|
19 | // } |
---|
20 | |
---|
21 | abstractSoftware::abstractSoftware(string inputFileName, computingBlock* cmpb, dataManager* data) |
---|
22 | { |
---|
23 | inputFileName_ = inputFileName; |
---|
24 | compBlock_ = cmpb; |
---|
25 | dataManager_ = data; |
---|
26 | cout << " abstractSoftware::abstractSoftware adresse manager " << dataManager_ << endl; |
---|
27 | nameOfSoftware_ = new nomDeLogiciel("unknownSoftware"); |
---|
28 | } |
---|
29 | |
---|
30 | |
---|
31 | |
---|
32 | bool abstractSoftware::launchJob(string commandLine, string& resul) |
---|
33 | { |
---|
34 | bool ExecuteStatus = true; |
---|
35 | |
---|
36 | FILE* pp = popen(commandLine.c_str(), "r"); |
---|
37 | ostringstream sortie; |
---|
38 | if (pp == NULL) { |
---|
39 | sortie << " launching failed : " << commandLine << endl; |
---|
40 | ExecuteStatus = false; |
---|
41 | } else { |
---|
42 | // on copie la sortie dans le fichier assigne |
---|
43 | char buf[132]; |
---|
44 | while (fgets(buf, sizeof buf, pp)) |
---|
45 | { |
---|
46 | sortie << buf; |
---|
47 | } |
---|
48 | pclose(pp); |
---|
49 | } |
---|
50 | resul = sortie.str(); |
---|
51 | return ExecuteStatus; |
---|
52 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.