getline compiler error

I want to use getline in order to read data from a text file. The file opens successfully and the program can read the data from the file when I use the following command:
input_file >> c;
but when I use getline:
getline (input_file, number, '>');
there is a compiler error:
no matching function for call to 'getline(std::ifstream, int&, char)'
What am I doing wrong?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <cstdio>
#include <fstream>
#include <iostream>
using namespace std;
 
int main () {
char c;
int number;
ifstream input_file;
input_file.open("input.txt", ios::in);
if (input_file.is_open()) {
     input_file >> c;
     if (c!='<') {
         cout << "Error: wrong file";
         exit (2);
     }
     getline (input_file, number, '>');
     cout << number << endl;
}
input_file.close();
return 0;
}
Last edited on
getline doesn't work with integers, only strings.
Oh, thank you very much, I didn't know that!
Topic archived. No new replies allowed.