From 21a0ff691cd5470aa7e8ddee01ee45142679b3c0 Mon Sep 17 00:00:00 2001 From: "michael@kerber-sls.de" Date: Thu, 28 Mar 2013 18:41:49 +0000 Subject: Made read_ascii more tolerant wrt whitespaces git-svn-id: https://phat.googlecode.com/svn/trunk@10 8e3bb3c2-eed4-f18f-5264-0b6c94e6926d --- include/phat/boundary_matrix.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/include/phat/boundary_matrix.h b/include/phat/boundary_matrix.h index 63c0dc4..6700b3d 100644 --- a/include/phat/boundary_matrix.h +++ b/include/phat/boundary_matrix.h @@ -166,9 +166,12 @@ namespace phat { return false; index number_of_columns = 0; - while( getline( dummy, cur_line ) ) + while( getline( dummy, cur_line ) ) { + cur_line.erase(cur_line.find_last_not_of(" \t\n\r\f\v") + 1); if( cur_line != "" && cur_line[ 0 ] != '#' ) number_of_columns++; + + } this->set_num_cols( number_of_columns ); dummy.close(); @@ -179,6 +182,7 @@ namespace phat { column temp_col; index cur_col = -1; while( getline( input_stream, cur_line ) ) { + cur_line.erase(cur_line.find_last_not_of(" \t\n\r\f\v") + 1); if( cur_line != "" && cur_line[ 0 ] != '#' ) { cur_col++; std::stringstream ss( cur_line ); -- cgit v1.2.3