]> Creatis software - bbtk.git/commitdiff
skip lines
authordavila <eduardo.davila@creatis.insa-lyon.fr>
Wed, 18 Feb 2015 17:36:11 +0000 (18:36 +0100)
committerdavila <eduardo.davila@creatis.insa-lyon.fr>
Wed, 18 Feb 2015 17:36:11 +0000 (18:36 +0100)
packages/std/src/bbstdReadColumnsString.cxx
packages/std/src/bbstdReadColumnsString.h

index 6d9cfe5f3c37b055e60f7449ff3b18648660deb7..afcd636ac19ec6afaa37115cfe629624771fbd22 100644 (file)
@@ -55,12 +55,18 @@ void ReadColumnsString::Process()
                tlst.push_back( new std::vector<std::string> );
        }       
        
+       int iSkipLines;
        int numberOfLines = 0;
-       char tmpValue[50];
+       char tmpValue[500];
        std::vector<std::string> *vecData;
        FILE *ff1 = fopen( bbGetInputFileName().c_str() , "r+" );
        if (ff1!=NULL)
        {
+               for (iSkipLines=0;iSkipLines<bbGetInputSkipLines(); iSkipLines++ )
+      {
+         fgets( tmpValue , 500, ff1 ); 
+      }
+
                while (!feof(ff1))
                {
                        for( i=0 ;  i<bbGetInputDimension() ; i++)
@@ -99,6 +105,7 @@ void ReadColumnsString::bbUserSetDefaultValues()
 
 //  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
 //    Here we initialize the input 'In' to 0
+       bbSetInputSkipLines(0); 
        bbSetInputDimension(1); 
        bbSetInputFileName(""); 
   
index 09197bc3dd011e47c8811b882ce390d3e71a06ea..47f18e97d3594519ec4c12d65bc525766a0515fa 100644 (file)
@@ -46,6 +46,7 @@ class bbstd_EXPORT ReadColumnsString
 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
 //===== 
        BBTK_DECLARE_INPUT(FileName,std::string);
+       BBTK_DECLARE_INPUT(SkipLines,int);      
        BBTK_DECLARE_INPUT(Dimension,int);      
        
        BBTK_DECLARE_OUTPUT(lstData1,std::vector<std::string> );
@@ -72,6 +73,7 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(ReadColumnsString,bbtk::AtomicBlackBox);
        BBTK_DESCRIPTION("Read Columns from a text file");
        BBTK_CATEGORY("read/write");
        BBTK_INPUT(ReadColumnsString,FileName,"File name of Points",std::string,"");
+       BBTK_INPUT(ReadColumnsString,SkipLines,"(default 0) - Number of lines to be skipe before read data",int,"");
        BBTK_INPUT(ReadColumnsString,Dimension,"(default 1) - The number of columns of the file",int,"");
        
        BBTK_OUTPUT(ReadColumnsString,lstData1,"vector of data",std::vector<std::string>,"");