0

i have a problem with my code.

void readSis(string sisName) {
        ifstream infile(sisName.c_str());
        Data platform;

        // todo: split tiap =
        platform.N = atof(readInputLine(infile).c_str());
        platform.Ti = atof(readInputLine(infile).c_str());
        platform.SIL = atof(readInputLine(infile).c_str());

        // save Ti  
        ostringstream temp;
        temp << platform.Ti;
        Ti = temp.str();

        // save SIL 
        ostringstream temp1;
        temp1 << platform.SIL;


        // calling prism function
        cout << "Calling PRISM Software in C:Program Files/prism-4.3.1/bin/prism" << endl;
        cout << "Executing model and properties......" << endl;
        cout << "Please wait for some moments......" << endl;

        callPrismBat();

    // calling readtxt function
    cout << "Processing PFD.txt...." << endl;
    readtxt("PFD.txt");

    cout << "SIL calculation has been done in file SILCalc.SIS" << endl << endl;
}

my code is created to read the input of a file with .sis extension. there are 3 variable that i want to get : N, Ti and SIL. My problem is, i want to save the value from platform.SIL with temp1 (variable) and store temp1 as an integer value because i want to make an operation from the value. can anybody help me?

thank you

Refan
  • 1
  • Use [**std::floor**](http://en.cppreference.com/w/cpp/numeric/math/floor). Just add `floor(atof(readInputLine(infile).c_str()))` – Ishpreet Sep 25 '17 at 09:06
  • how to store it sir? i know i can store it as a string variable just like how I store Ti value with Ti = temp.str();. what is other command to store it as an integer? – Refan Sep 25 '17 at 09:24

0 Answers0