-#include <stdio.h>
#include <stdio.h>
#include <iostream>
#include <fstream>
#include <vector>
-
- 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 << "|||| "<<argv[i]<<std::endl;
+ }
+ std::cerr << "usage : "<< argv[0] <<" -fileIn \"-FindString\" \"-ReplaceString\"" << std::endl;
return 1;
}
}
fclose(ffIn);
} else {
- std::cerr << "ERROR. File : "<< argv[1] <<" Not exists." << std::endl;
+ std::cerr << "ERROR. File : "<< argv[1] <<" does not exists." << std::endl;
return 1;
}