The well known way of creating an fstream
object is:
ifstream fobj("myfile.txt");
ie. using a filename.
But I want to create an ifstream object using a file descriptor.
Reason: I want to execute a command using _popen()
. _popen()
returns the output as a FILE*
. So there is a FILE* pointer involved but no filename.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…