SilkyFalcon

Generation

generate functionWed, 07 Dec 2022

open every file in a specific folder than open all of them and write "Coded by Inventex" to the first line as a comment

#include <bits/stdc++.h> #include <string> #include <fstream> using namespace std; int main() { string path = "C:\\Users\\source"; //path of the folder string comment = "//Coded By Inventex"; vector<string> files; for (const auto& entry : filesystem::directory_iterator(path)) { files.push_back(entry.path().string()); } for(int i = 0; i < files.size(); i++) { ofstream f(files[i], ios::app); f << comment; f.close(); } return 0; }

Questions about programming?Chat with your personal AI assistant