fork(1) download
  1. #include <string>
  2. #include <cstring>
  3. #include <iostream>
  4.  
  5. using namespace std;
  6.  
  7. const char * from = "\\\\devserver\\project";
  8. const char * to = "C:";
  9.  
  10. int main(int argc, const char * argv[])
  11. {
  12. string x = "\\\\devserver\\project\\test";
  13. cout << "Before: " << x << endl;
  14. size_t pos = x.find(from);
  15. if (pos != string::npos)
  16. x.replace(pos,strlen(from),to);
  17. cout << "After: " << x << endl;
  18. }
  19.  
  20.  
Success #stdin #stdout 0s 3456KB
stdin
Standard input is empty
stdout
Before: \\devserver\project\test
After: C:\test