c++ - QT Read file, convert to int and use as initial slider value -


i've made horizontal slider, value being saved in text file. after app closed slider resets initial value of "1". using -

ui->horizontalslider->setvalue(read()); 

i want read value of file using read() function , set initial value slider results in value being restored / saved.

this read(); function-

int read(){     std::fstream readfile;     readfile.open("bin\ram.dat");     std::string value;     readfile << value;     int value2 = atoi(value.c_str());     return value2; } 

after lot of different variable types being used , few conversion not work. question- how set initial value of slider int located in "bin\ram.dat"? i'm beginner tips or clues more welcome. thanks! (i've googled before posting , found few codes did not work here)


Comments

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -