X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;ds=sidebyside;f=appli%2FcreaSed%2FcreaSed.cpp;h=96ad6b8bfd1cca6f89b38dcf05a150a0ab022f4f;hb=08d413da4e6a2345cf06424418857a4f6715daf9;hp=51ca114fd82642ab297d8bf2015eb1f725a99c74;hpb=79358c74d60247bf322fc38d38ce7d95a6c41abf;p=crea.git diff --git a/appli/creaSed/creaSed.cpp b/appli/creaSed/creaSed.cpp index 51ca114..96ad6b8 100644 --- a/appli/creaSed/creaSed.cpp +++ b/appli/creaSed/creaSed.cpp @@ -1,5 +1,4 @@ -#include #include #include #include @@ -7,30 +6,31 @@ #include - - void replace( std::string& str, - const std::string& from, - const std::string& to ) - { - using std::string; - string::size_type pos = str.find( from ); - while ( pos != string::npos ) - { - str.replace( pos, from.size(), to ); - pos = str.find( from, pos+from.size()-1 ); - } - } - - +//========================================================================== +void replace(std::string& str, + const std::string& from, + const std::string& to ) +{ + std::string::size_type pos = str.find( from ); + while ( pos != std::string::npos ) + { + str.replace( pos, from.size(), to ); + pos = str.find( from, pos+from.size()-1 ); + } +} +//========================================================================== //========================================================================== int main(int argc, char **argv) { - + if (argc!=4) { - std::cerr << "usage : "<< argv[0] <<" fileIn \"FindString\" \"ReplaceString\"" << std::endl; + for(int i = 1; i < argc; i++){ + std::cerr << "|||| "<