Jul 12, 2011 at 5:54pm UTC
Case Solved..
Last edited on Jul 18, 2011 at 12:23pm UTC
Jul 12, 2011 at 7:19pm UTC
what are you trying to do with this line?
data[] = edit;
Jul 13, 2011 at 2:05am UTC
I got it from a website where they want to change
100 50 20 90
4.07498 0.074984
37.1704 28.1704
20.3999 14.3999
48.627 35.627 ....
3rd line change from 20 to 19.98
100 50 19.98 90
4.07498 0.074984
37.1704 28.1704
20.3999 14.3999
48.627 35.627
....
The issue is, the array is already preset in the code.
What I want is that the user able to select the string they want and remove it, not by preset it. Is there any other method I can do it?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#include <fstream>
#include <ios>
#include <iterator>
#include <vector>
int main() {
std::vector<double > data;
std::fstream file("yourfile.txt" , std::ios::in | std::ios::out);
std::copy(std::istream_iterator<double >(file),
std::istream_iterator<double >(),
std::back_inserter(data));
file.clear();
file.seekp(0);
data[2] = 19.98;
std::copy(data.begin(), data.end(), std::ostream_iterator<double >(file, " " ));
return 0;
}
Last edited on Jul 13, 2011 at 2:36am UTC
Jul 14, 2011 at 7:26am UTC
Is there any method u all recommend? I saw string tokenizer but kinda confused on how they work
Jul 14, 2011 at 1:52pm UTC
I am actually not able to understand the problem.
Jul 15, 2011 at 4:52am UTC
Thx thou, I think I somehow managed to solve it!! Haha!!