Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Read floating point numbers into a dynamically allocated while increasing the size of the array while reading the file
- ifstream input("my-file.txt");
- vector<float> myValues;
- for (float f; input >> f; )
- myValues.push_back(f);
- ifstream input("my-file.txt");
- vector<float> myValues;
- myValues.insert(myValues.begin(),
- istream_iterator<float>(input),
- istream_iterator<float>());
- ifstream input("my-file.txt");
- vector< vector<float> > myValues;
- for (string line; getline(input, line); ) {
- stringstream lineStream(line);
- vector<float> thisLine;
- thisLine.insert(thisLine.begin(),
- istream_iterator<float>(lineStream),
- istream_iterator<float>());
- myValues.push_back(thisLine);
- }
Advertisement
Add Comment
Please, Sign In to add comment