Home > Back-end >  Novice c consult
Novice c consult

Time:09-16

C + + how to open a file (or photos or video)?

CodePudding user response:

Such as desktop document hehe (wanted to preach photos, but too slow to load)

CodePudding user response:

The document is called ha ha

CodePudding user response:

Using a library "fstream to solve
"Ifstream is to file read
Ofstream for file is written to the flow of
Fstream flow for file read and write

CodePudding user response:

Can you write a complete code

CodePudding user response:

I don't know you is to realize the file input and output?

Suppose you put the files and programs on the same path (i.e., the same folder), you can like this:

Freopen (" STH. In ", "r", stdin);
Freopen (" STH. Out ", "w", stdout);

Then you read data from STH. In this file read (you can modify the name of your file name), the output data in STH. Out (also can be modified),

This can be achieved is the file input and output,

Pictures I won't, please trust,

CodePudding user response:

Thank you, could you tell me how to open the photo

CodePudding user response:

#include

#include

using namespace std;

Int main ()
{
Freopen (" h.t xt ", "r", stdin);
Freopen (" h.t xt ", "w", stdout);
return 0;
}
Would you please tell me why the code has a problem,,,

CodePudding user response:

references at the end of the 7th floor filmmaker 014 response:
# include & lt; Iostream>

#include

using namespace std;

Int main ()
{
Freopen (" h.t xt ", "r", stdin);
Freopen (" h.t xt ", "w", stdout);
return 0;
}
Would you please tell me why the code has a problem,,,
there is no problem
  • Related