First question
Suppose there is a function Func() . How can I implement the creation of a separate out text file with the name ΠΈΠΌΡ_ΡΠ°ΠΉΠ»Π°.txt using streams with each function call?
ofstream out; out.open("ΠΈΠΌΡ_ΡΠ°ΠΉΠ»Π°.txt"); but so that a number (sequence number) is added to the file name each time, like ΠΈΠΌΡ_ΡΠ°ΠΉΠ»Π°_1.txt on the first call to the function, ΠΈΠΌΡ_ΡΠ°ΠΉΠ»Π°_2.txt on the second call.
Second question
The user enters the path to the file, for example, D:\ΠΠΎΠΊΡΠΌΠ΅Π½ΡΡ\input.txt . The program reads this, but when you try to open such a file along this path, an error appears as if the file is not open.
cout << "Type full path to the file" << endl; gets_s(path); ifstream dump; dump.open(path); if (!dump.is_open()) cout << "File is not opened" << endl; How to fix this error?