0

How can I read a matrix with getline from a file. Please see example. What is the best way to read this from file?thanks

2 3 000 000 000

6th Feb 2019, 10:45 PM
Olga Mohan
Olga Mohan - avatar
2 Antworten
0
do you have to use getline()?? if not maybe consider... Use ifstream to read data from a file: std::ifstream input( "filename.ext" ); If you really need to read line by line, then do this: for( std::string line; getline( input, line ); ) { ...for each line in input blah blah lol }
7th Feb 2019, 1:28 AM
peter
peter - avatar
0
Thank for your answer, do you think that with simple ifstream reading should be ok? Because the first two lines are different, and I am thinking that ,this might cause a problem
7th Feb 2019, 5:48 AM
Olga Mohan
Olga Mohan - avatar