Thread: fstream issues

    #1
  1. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2002
    Posts
    421
    Rep Power
    12

    fstream issues


    It keeps giving me an error where I bolded the text..Im trying to input the value of num to num.dat. The error is this:

    error C2676: binary '<<' : 'class std::basic_ifstream<char,struct std::char_traits<char> >' does not define this operator or a conversion to a type acceptable to the
    predefined operator

    HELP? Code:


    mydata.open("mydata.dat", ios::app);
    if (mydata)
    {
    mydata << num << ". " << names << "\n" << address << "\n" << city << "\n" << state << "\n" << zip << "\n\n";
    mydata.close();
    num++;
    count.open("num.dat", ios::out);
    if (count)
    {
    count << num;
    count.close();
    }
    }
    else
    {
    cout << "error!";
    }
    }
    hmmm...
  2. #2
  3. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2002
    Posts
    421
    Rep Power
    12
    NM I GOT IT..should have been ofstream..
    hmmm...

IMN logo majestic logo threadwatch logo seochat tools logo