ifstream problem

This is a discussion on ifstream problem within the C++ Programming forums, part of the General Programming Boards category; Code: string Name = action.inputDirectory + action.inputName; ifstream bitmap(Name, ios::binary); Is my problem that I'm using a C++ style string ...

  1. #1
    Work in Progress..... Jaken Veina's Avatar
    Join Date
    Mar 2005
    Location
    Missouri. Go Imos Pizza!
    Posts
    256

    ifstream problem

    Code:
    string Name = action.inputDirectory + action.inputName;
    
    ifstream bitmap(Name, ios::binary);
    Is my problem that I'm using a C++ style string for Name instead of C style? I'm being told that bitmap has an incomplete type.
    Code:
    void function(void)
     {
      function();
     }

  2. #2
    Registered User Micko's Avatar
    Join Date
    Nov 2003
    Posts
    712
    Use Name.c_str(), ifstream constructor takes const char* so that is why you need to convert Name to C-style string

    - Micko
    Last edited by Micko; 07-07-2005 at 02:45 PM.
    Gotta love the "please fix this for me, but I'm not going to tell you which functions we're allowed to use" posts.
    It's like teaching people to walk by first breaking their legs - muppet teachers! - Salem

  3. #3
    Work in Progress..... Jaken Veina's Avatar
    Join Date
    Mar 2005
    Location
    Missouri. Go Imos Pizza!
    Posts
    256
    Thought so. Thanks.

    EDIT: I'm still getting that error, though.
    Last edited by Jaken Veina; 07-07-2005 at 02:55 PM.
    Code:
    void function(void)
     {
      function();
     }

  4. #4
    Registered User
    Join Date
    Jan 2005
    Posts
    7,317
    Did you include <fstream> and specify the std namespace?

  5. #5
    Work in Progress..... Jaken Veina's Avatar
    Join Date
    Mar 2005
    Location
    Missouri. Go Imos Pizza!
    Posts
    256
    Ahh. fstream it is. Thanks.
    Code:
    void function(void)
     {
      function();
     }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. linked list problem
    By kzar in forum C Programming
    Replies: 8
    Last Post: 02-05-2005, 03:16 PM
  2. small reference problem
    By DavidP in forum C++ Programming
    Replies: 6
    Last Post: 06-21-2004, 07:29 PM
  3. Problem with destructors.
    By Hulag in forum C++ Programming
    Replies: 7
    Last Post: 06-11-2004, 12:30 PM
  4. problem with output
    By Garfield in forum C Programming
    Replies: 2
    Last Post: 11-18-2001, 07:34 PM
  5. Big Code, Little Problem
    By CodeMonkey in forum Windows Programming
    Replies: 4
    Last Post: 10-03-2001, 05:14 PM

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