--- projects/cms/source/host/c++/SysMon.cpp 2001/03/05 12:38:35 1.2 +++ projects/cms/source/host/c++/SysMon.cpp 2001/03/06 00:38:32 1.3 @@ -39,12 +39,14 @@ int SysMon::collect(){ if ( debug == 1 ){ std::cout << "SysMon::collect::ipipestream\n"; } - ipipestream p("statgrab.pl"); + // ipipestream p("statgrab.pl"); + p = new SubPipe("statgrab.pl"); // get the output into input from statgrab - while ( p.getline (input, 2048) ){ + string sinput; + while ( p->getLine(&sinput) ){ // find the first non-whitespace char in input - string sinput = input; + // locate the first white space int found = sinput.find(" ",0); if ( found == string::npos ){ @@ -65,22 +67,28 @@ int SysMon::collect(){ } gotTitle = 1; // now modify the data in the arrays if they are numbers - int * end; + char * end; char *buffer; // buffer = sinput.substr(found+1, sinput.length()); - double dbl = 0; // strtod((char *) sinput.substr(found+1, sinput.length()), &end); + double dbl = strtod( ((string) sinput.substr(found+1, sinput.length())).c_str(), &end); if ( dbl == 0 ){ // error? we aren't so sure. check the position // of end. if ( *end == sinput.length()-1 ){ // was the end.. ok - - } // if + // must have worked! + double dbl2 = 0; //strtod(values[i], &end); + dbl2 += dbl; + char * buffer; + int precision = 5; + int decimal, sign; + buffer = ecvt (dbl2, precision, &decimal, &sign); + } // if *end } else { // must have worked! double dbl2 = 0; //strtod(values[i], &end); dbl2 += dbl; - char *buffer; + char * buffer; int precision = 5; int decimal, sign; buffer = ecvt (dbl2, precision, &decimal, &sign); @@ -104,7 +112,7 @@ int SysMon::collect(){ } // while - // delete p; + delete p; if ( debug == 1 ){ std::cout << "SysMon::collect::Parse from StatGrab finished\n"; @@ -134,10 +142,8 @@ string SysMon::getData(){ string level = root; string attributes = ""; string attr = ""; - // while ( i < titlepointer ){ - // hard coding - while ( i < 10 ){ - finished = 0; + while ( i < titlepointer ){ + finished = 0; count = 0; attr = ""; while ( finished != 1 ){