Hi!
I am trying to create a file pointer so I can read characters from a text file. I am not sure that I am doing this correctly. I have been reading a book I have, but I have not quite grasped this concept. The part in red is the section I am having difficulty:
Thanks for any help!Code:#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
using namespace std;
void welcome (void);
void getfile (FILE *);
int main (void){
FILE fptr;
welcome();
getfile(&fptr);
return(0);
}
void welcome(void){
cout << "\n\nLetter Counter\n\nWelcome to the letter counter. This ";
cout << "program will prompt you for an input file of\ntext. It ";
cout << "will read the text and report the number of times each ";
cout << "letter of the\nalphabet is used. It will also display a ";
cout << "visual graph.\n\n";
return;
}
void getfile(FILE *fptr){
string filename;
cout << "Please provide filename for input file: ";
cin >> filename;
ifstream *fptr.open(filename(), ios::in);
return;
}