Hi all, I'm trying to open a file to write to. However, I'm getting an error, that is,
std::ifstream has no member named 'is'
. Here is my code:
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
|
#include <iostream>
#include <fstream>
#include <string>
#include <cstdlib>
#include <cmath>
using namespace std;
int main()
{
char filename[50];
ifstream kyle;
cin.getline(filename,50);
kyle.open(filename);
if(!kyle.is.open()){
exit(EXIT_FAILURE);
}
char word[50];
kyle >> word;
while(kyle.good()){
cout << word << " ";
kyle >> word;
}
}
| |
Last edited on
if(!kyle.is.open()){
Try
if(!kyle.is_open()){
Glad I could help. I make little mistakes like that all the time.