]> Creatis software - bbtk.git/commitdiff
bbstdReadColumnsDouble adds an extra line at the end of the read file.
authorClaire Mouton <claire.mouton@creatis.insa-lyon.fr>
Wed, 23 Jan 2013 11:40:27 +0000 (12:40 +0100)
committerClaire Mouton <claire.mouton@creatis.insa-lyon.fr>
Wed, 23 Jan 2013 11:40:27 +0000 (12:40 +0100)
Bug #1897

packages/std/src/bbstdReadColumnsDouble.cxx
packages/vtk/src/bbvtkSphereList.cxx

index 95a8576a432aa975795da5efac6e959deaf3db15..c74a39fd1ff6e68a03059648200135ad841ce4b2 100644 (file)
@@ -56,13 +56,16 @@ void ReadColumnsDouble::Process()
        FILE *ff1 = fopen( bbGetInputFileName().c_str() , "r+" );
        if (ff1!=NULL)
        {
+                if (!feof(ff1))
+                        fscanf(ff1,"%s",tmpValue);
+
                while (!feof(ff1))
                {
                        for( i=0 ;  i<bbGetInputDimension() ; i++)
                        {
-                               fscanf(ff1,"%s",tmpValue);
                                vecData=tlst[i];
                                vecData->push_back( atof(tmpValue) );
+                                fscanf(ff1,"%s",tmpValue);
                        }       
                        numberOfLines++;                        
                }       
index 8d5cfe7069f7604a2069db6f0957d108a9daa25a..50889bd9dc746a47fba9e79a37a34de6f5f8c0c8 100644 (file)
@@ -82,8 +82,7 @@ void SphereList::Process()
                         std::cout << "CM SphereList::Process i=" <<  i  << " bbGetInputlstPointZ()[i]=" << bbGetInputlstPointZ()[i] << std::endl;
                       }
                     // If the vector Y or respectively the vector Z has a different size from the vector X, the position value py or respectively pz is set to 0.
-                    // Stops at iMax - 1 because of a bug of the box stdReadColumnsDouble creating an extra line at the end of the file.
-                    for ( int i=iMin ; i<iMax-1; i=i+1 )
+                    for ( int i=iMin ; i<iMax; i=i+1 )
                     {
                        px = bbGetInputlstPointX()[i]*spc[0];
                        if (bbGetInputlstPointY().size() == bbGetInputlstPointX().size() )