X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FFDM%2FUIUCModel%2Fuiuc_2DdataFileReader.cpp;h=6faabfdce635566be33ad99cc066a0b9bc021673;hb=70b4f38ebccbafea664ed2310eaf990bd2b9edd8;hp=890d20dd49b6cda56f154ea0e46ce28bdae857aa;hpb=8f3aa1bebd7c60b1ad328d10beae841daab4e292;p=flightgear.git diff --git a/src/FDM/UIUCModel/uiuc_2DdataFileReader.cpp b/src/FDM/UIUCModel/uiuc_2DdataFileReader.cpp index 890d20dd4..6faabfdce 100644 --- a/src/FDM/UIUCModel/uiuc_2DdataFileReader.cpp +++ b/src/FDM/UIUCModel/uiuc_2DdataFileReader.cpp @@ -18,10 +18,16 @@ ---------------------------------------------------------------------- HISTORY: 02/29/2000 initial release + 10/25/2001 (RD) Modified so that it recognizes a + blank line + 06/30/2003 (RD) replaced istrstream with istringstream + to get rid of the annoying warning about + using the strstream header ---------------------------------------------------------------------- AUTHOR(S): Jeff Scott + Robert Deters ---------------------------------------------------------------------- @@ -65,28 +71,24 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, - USA or view http://www.gnu.org/copyleft/gpl.html. + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **********************************************************************/ #include "uiuc_2DdataFileReader.h" -int uiuc_2DdataFileReader( string file_name, - double convert_x, - double convert_y, - double convert_z, - double x[100][100], - double y[100], - double z[100][100], - int xmax[100], - int &ymax) +void uiuc_2DdataFileReader( string file_name, + double x[100][100], + double y[100], + double z[100][100], + int xmax[100], + int &ymax) { ParseFile *matrix; double token_value1; double token_value2; - int counter_y = 1, counter_x = 1, data = 0; + int counter_y = 1, counter_x = 1; string linetoken1; string linetoken2; @@ -101,17 +103,20 @@ int uiuc_2DdataFileReader( string file_name, linetoken1 = matrix -> getToken(*command_line, 1); // gettoken(string,tokenNo); linetoken2 = matrix -> getToken(*command_line, 2); // 2 represents token No 2 - istrstream token1(linetoken1.c_str()); - istrstream token2(linetoken2.c_str()); + istringstream token1(linetoken1.c_str()); + istringstream token2(linetoken2.c_str()); - //reset token_value2 for first if statement + //reset token_value1 and token_value2 for first if statement + token_value1 = -999; token_value2 = -999; token1 >> token_value1; token2 >> token_value2; + //chenk to see if it is a blank line + if (token_value1==-999 && token_value2==-999); //check to see if only one value on line (token2 blank) - if (token_value2 == -999) + else if (token_value2 == -999) { y[counter_y] = token_value1 * convert_y; @@ -128,8 +133,8 @@ int uiuc_2DdataFileReader( string file_name, counter_x++; } } - data = 1; - return data; + delete matrix; + return; } // end uiuc_2DdataFileReader.cpp