Thread: Ifstream Problems

  1. #1
    Registered User
    Join Date
    Apr 2002

    Unhappy Ifstream Problems

    For the first time I have used the appwizard in MFC to create a Dialog based app. Now I'm trying to do some ifstream stuff... as follows:

    CString name;

    ifstream test;"C:\\example.txt");
    test >> name;

    And I get the error:
    error C2678: binary '>>' : no operator defined which takes a left-hand operand of type 'class ifstream' (or there is no acceptable conversion)

    I have added the #include <fstream.h> and/or #include <fstream> statements but always get some sort of error. Could someone help me? I have done this in other projects and they usually work. I have done so much with this project to have something like this keep me back!


  2. #2
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Try to avoid mixing object libraries.......use a CFile in substitute for the ifstream

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. String Manipulation problems -_-
    By Astra in forum C Programming
    Replies: 5
    Last Post: 12-13-2006, 05:48 PM
  2. Rendering problems (DirectX?)
    By OnionKnight in forum Tech Board
    Replies: 0
    Last Post: 08-17-2006, 12:17 PM
  3. contest problems on my site
    By DavidP in forum Contests Board
    Replies: 4
    Last Post: 01-10-2004, 09:19 PM
  4. Read problems
    By xddxogm3 in forum C++ Programming
    Replies: 10
    Last Post: 10-05-2003, 12:17 AM
  5. DJGPP problems
    By stormswift in forum C Programming
    Replies: 2
    Last Post: 02-26-2002, 04:35 PM