Thread: ifstream

  1. #1
    pwns nooblars
    Join Date
    Oct 2005
    Location
    Portland, Or
    Posts
    1,094

    ifstream

    I may be missing something but I have been searching and haven't come up with anything yet... but I can't seem to use ifstream... I tried including (#inclulde <ifstream>) and MinGW puked it back at me saying "ifstream: No such file or directory". So I tried to just include (#include <fstream>) and it includes it then doesn't allow me to use ifstream...

    I am using Code::Blocks built Sept 11, 2006 and MinGW 3.4.2...

    I am new to Code::Blocks and haven't done much compiling via commandline with MinGW.

  2. #2
    Reverse Engineer maxorator's Avatar
    Join Date
    Aug 2005
    Location
    Estonia
    Posts
    2,318
    Maybe try <istream.h> or <ostream.h>
    "The Internet treats censorship as damage and routes around it." - John Gilmore

  3. #3
    pwns nooblars
    Join Date
    Oct 2005
    Location
    Portland, Or
    Posts
    1,094
    But what gets me is the inablity to use ifstream... which is typedef'd in iosfwd.h which is included in ios.h which is included in istream.h which is included in fstream... (the .h's may be off since I am going by memory due to that computer being reset atm.)

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Mmm, this seems OK with cygwin g++
    Code:
    #include <iostream>
    #include <string>
    #include <fstream>
    using namespace std;
    
    int main(void) {
        ifstream foo("new.c");
        char c = foo.get();
        cout << "First char is " << c << endl;
        foo.close();
    }
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Simple ifstream Question
    By Paul22000 in forum C++ Programming
    Replies: 8
    Last Post: 12-05-2008, 05:34 PM
  2. store data from ifstream and store in link list
    By peter_hii in forum C++ Programming
    Replies: 2
    Last Post: 10-26-2006, 08:50 AM
  3. ofstream and ifstream for searching and writing
    By johnnyd in forum C++ Programming
    Replies: 6
    Last Post: 03-17-2003, 08:34 AM
  4. ifstream
    By Klinerr1 in forum C++ Programming
    Replies: 2
    Last Post: 07-22-2002, 11:18 PM
  5. Ifstream Problems
    By IlUomo in forum Windows Programming
    Replies: 1
    Last Post: 04-24-2002, 12:51 PM