Advertisement
Guest User

Untitled

a guest
Mar 26th, 2013
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.34 KB | None | 0 0
  1. #include <fstream>
  2. #include <iostream>
  3. #include <string>
  4.  
  5. int main()
  6. {
  7.  
  8.     std::string oldFilename;
  9.    
  10.     while (getline(std::cin, oldFilename)) {
  11.            
  12.             std::string newFilename;
  13.             {
  14.                 std::ifstream file(oldFilename.c_str());
  15.                 getline(file, newFilename);
  16.             }
  17.            
  18.         rename(oldFilename.c_str(), (newFilename + ".txt").c_str());
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement