Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- #include <iostream>
- #include <string>
- int main()
- {
- std::string oldFilename;
- while (getline(std::cin, oldFilename)) {
- std::string newFilename;
- {
- std::ifstream file(oldFilename.c_str());
- getline(file, newFilename);
- }
- rename(oldFilename.c_str(), (newFilename + ".txt").c_str());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement