Welcome to the boards.
To have a pointer to the files contents, you will have to read the files contents into a buffer. There are many ways to do this. Here's one way to read the entire contents of a file into a dynamically allocated buffer:
Code:
#include <fstream>
#include <iostream>
#include <memory>
using namespace std;
int main()
{
// open the stream as binary so we can get the size of the file
ifstream f("input.txt", ios::in | ios::binary);
if (!f)
{
cout << "Failed to open" << endl;
return 1;
}//if
// get the size of the file
f.seekg(0, ios::end);
size_t fsz = f.tellg();
f.seekg(0, ios::beg);
// allocate room for the file's contents and a null terminator
auto_ptr<char> fp_ap(new char[fsz + 1]);
char *fp = fp_ap.get();
// read in the whole file
f.read(fp, fsz);
f.close();
if (!f.good())
{
cerr << "Failed to read" << endl;
return 2;
}//if
// null terminate the entire file contents as a string
fp[fsz] = 0;
cout << fp << endl;
return 0;
}//main
gg