MFC and <fstream>

This is a discussion on MFC and <fstream> within the C++ Programming forums, part of the General Programming Boards category; Hi EveryOne, I am trying to write an MFC console based app, and having problem by boing #include<fstream>. I have ...

  1. #1
    Registered User
    Join Date
    Oct 2001
    Posts
    68

    Question MFC and <fstream>

    Hi EveryOne,


    I am trying to write an MFC console based app, and having problem by boing #include<fstream>. I have attached the code. please tell me why am i having problem.


    Code:
    // AVIPARSER.cpp : Defines the entry point for the console application.
    //
    
    #include "stdafx.h"
    #include <fstream.h>
    #include "AVIPARSER.h"
    
    #ifdef _DEBUG
    #define new DEBUG_NEW
    #undef THIS_FILE
    static char THIS_FILE[] = __FILE__;
    #endif
    
    /////////////////////////////////////////////////////////////////////////////
    // The one and only application object
    
    CWinApp theApp;
    
    using namespace std;
    
    int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
    {
    	int nRetCode = 0;
    
    	// initialize MFC and print and error on failure
    	if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
    	{
    		// TODO: change error code to suit your needs
    		cerr << _T("Fatal Error: MFC initialization failed") << endl;
    		nRetCode = 1;
    	}
    	else
    	{
    				
    	}
    
    	return nRetCode;
    }

  2. #2
    Registered User
    Join Date
    Apr 2002
    Posts
    362
    Any file extension with .h is not part of namespace std. The global namespace, yes, but not namespace std.

    Unfortunately, compiling your code is not an option, so this is the best I can come up with for you.

    P.S. I'm not sure what "boing" is. (Please re-read your first sentence.)

    -Skipper
    "When the only tool you own is a hammer, every problem begins to resemble a nail." Abraham Maslow

  3. #3
    Registered User hk_mp5kpdw's Avatar
    Join Date
    Jan 2002
    Location
    Northern Virginia/Washington DC Metropolitan Area
    Posts
    3,802
    P.S. I'm not sure what "boing" is. (Please re-read your first sentence.)
    My best guess is this person meant to say "doing".
    "Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
    -Christopher Hitchens

  4. #4
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,789
    Try not to mix the std libraries and the MFC libraries....

    MFC provides a useful alternative in the CFile object - look it up

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. use <fstream> and ostream overloading together
    By mosu' in forum C++ Programming
    Replies: 3
    Last Post: 08-16-2006, 01:06 PM
  2. <fstream> again !!!!!
    By ElastoManiac in forum C++ Programming
    Replies: 8
    Last Post: 12-19-2005, 02:45 PM
  3. <fstream> arghghghhhhhhhh
    By ElastoManiac in forum C++ Programming
    Replies: 26
    Last Post: 12-02-2005, 05:38 AM
  4. About "fstream" in <fstream.h> and <fstream>
    By L.O.K. in forum C++ Programming
    Replies: 5
    Last Post: 01-08-2005, 05:49 PM
  5. allegro weirdness, <fstream> errors
    By ichijoji in forum Game Programming
    Replies: 2
    Last Post: 02-16-2003, 08:46 PM

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