need help on string objects homework

Line 42: it says "no matching function call to std::basic ifstream char..." and then in the next line it says "note: candidate is:. it works fine if I hardcode the file name into the program, but for some reason it wont let me let the user specify the name.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
 // lab 3:  Madlibs game
// Written by:
// Date:

#include <iostream>
#include <cctype>
#include <string>
#include <fstream>

using namespace std;

int readFile(string ** story);

int main()
{
	string * story;
	int count = readFile(&story);   // count is number of lines in the file
	if (count == -1)				// which is also the number of elements in the array
		return 1;
	/*play(story, count);
	print(story, count);*/

	return 0;
}

// readFile: read lines of the file into an array of C++ strings
//           each line is a string element in the array
// input: address of the array
// return: -1 if file open fails
//         number of lines in the file if file reading is successful

int readFile(string ** story)
{
    ifstream inFile;
    string filename;
    string temp;
    int count = 0;

    cout << "Enter the name of the file." << endl;
    cin >> filename;
    inFile.open(filename);

    if(inFile)
    {
        while (inFile >> temp)
        {
            inFile.ignore(80,'\n');
            count++;
        }
        cout << count << endl;
        inFile.close();
        return count;
    }
    else
    {
        cout << "Error reading file." << endl;
        return -1;
    }

}

// print: print the story in the array
// input: address of array, number of elements
// return: nothing


// play: prompt the user with each keyword and replace the keyword with the user input
//       user input must be a C string, and it can be multiple words
//       user input is capitalized when stored in the string
// input: address of the array, number of elements
// return: nothing


> then in the next line it says "note: candidate is:.
keep reading
Topic archived. No new replies allowed.