保存变量的值并将其存储为int

时间:2017-09-25 08:57:55

标签: c++ readfile

我的代码有问题。

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;
}

创建我的代码以读取扩展名为.sis的文件的输入。我想得到3个变量:N,Ti和SIL。我的问题是,我希望将platform.SIL的值保存为temp1(变量)并将temp1存储为整数值,因为我想从值中进行操作。有谁能够帮我?

谢谢

0 个答案:

没有答案