Ifstream Problems

This is a discussion on Ifstream Problems within the Windows Programming forums, part of the Platform Specific Boards category; For the first time I have used the appwizard in MFC to create a Dialog based app. Now I'm trying ...

  1. #1
    Registered User
    Join Date
    Apr 2002
    Posts
    3

    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;
    test.open("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!

    -juan

  2. #2
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,786
    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, 04: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, 08: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, 03:35 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21