The ignore( ) Function : ifstream « File « C++
- C++
- File
- ifstream
The ignore( ) Function

#include <iostream>
#include <fstream>
using namespace std;
int main()
{
ifstream in("test");
if(!in) {
cout << "Cannot open file.\n";
return 1;
}
in.ignore(10, ' '); // Ignore up to 10 characters or until first space is found.
char c;
while(in) {
in.get(c);
if(in) cout << c;
}
in.close();
return 0;
}
Related examples in the same category