#include
using namespace std;
Int main ()
{
Ifstream in;
In the open (" test. TXT ");
if(! In)
{
Cerr & lt; <"Failed to open the file" & lt;
}
Char x;
While (in & gt;> X)
{
Cout & lt;
Cout & lt;
return 0;
}
C: \ Users \ \ Administrator \ 7 fileinout CLionProjects \ \ cmake - build - the debug \ 7 fileinout. Exe
Failed to open the file
Process is over, the exit code 0
CodePudding user response:
In the opening set a breakpoint there, and then input err in watch window, hr, check the error valueCodePudding user response:
In the absolute path2. Put the file to the executable file directory at the same level
CodePudding user response:
You use the correct path, the test TXT to where natural machines don't know to open itCodePudding user response:
Then do you like the char is also very strange, you try a string, it is better to STL vessel instead of C type