c++ - File I/O in Functions? -
How am I trying to understand a file I / O function in C ++, but I do not To work properly, I am not currently at the present level to use vectors.
If someone can point me in the right direction, I would be grateful.
Here's the prototype:
string received_infilename (zero);
Function call:
inputFileName = get_inFileName ();
Function:
string received_infilename (zero) {string inFile; Cout & lt; & Lt; "Enter the name of the input file:"; Cin & gt; & Gt; in file; Cout & lt; & Lt; Endl; Return (infile); }
OK, I can think of working for your case most Closest
string get_inFileName (ifstream and inFileName) {std :: string inputFileName; Cout & lt; & Lt; "Enter the name of the input file:"; CIN & gt; & Gt; InputFileName; InFileName.open (inputFileName.c_str ()); Return inputFileName; }
Not claiming that this is a good implementation!
Comments
Post a Comment