Thread: If( false == true ) ... C++ enter in the code

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Feb 2006
    Posts
    10

    If( false == true ) ... C++ enter in the code

    Hi all,

    I'M using VS.net 2003.

    I'm following my code and at some point I found that the test I'M doing seems to not work at all...

    Code:
    	if ( false == true )
    	{
    		m_Type = GL_RGB;
    		m_NbComp = 3;
            }
    It's going in the m_Type = GL_RGB, and so on...

    It's an importer from 3dsmax, one model was working good, I made some changes and it stop working, because of the lines over...

    On the other model, it was the new that was crashing. Both are crashing around almost the same code, maybe the error is linked.

    Here's the code before my function :

    Code:
    //In the main
    	char* ImportFileName = "gob.amd";
    	printf("%s\n",ImportFileName);
    
    	if( data.m_Modele.Creer(ImportFileName) )
    
    .
    .
    .
    
    // In the m_Modele.Creer Function
    			if (Withalpha)
    			{
    				monomat->m_Tex = new Texture(TextureName,TexAlphaName,false,true);
    			}
    			else
    			{
    				monomat->m_Tex = new Texture(TextureName,true);
    			}
    
    //
    Texture::Texture(const char * File, Boolean GenID)
    : m_Type(0), m_NbComp(0), m_Height(0), m_Width(0), m_ID(-1), m_Texels(NULL)
    {
    	Creer(File,GenID);
    }
    
    //Now the place that it is crashing
    void Texture::Creer(const char * File, Boolean GenID)
    {
    	if (m_Type)
    		Detruire();
    
    	BMP_24bits BMP;
    	bool loadOk = LoadBMP(BMP,File);
    
    	loadOk = false;
    
    	if ( loadOk ) // false == true is entering here
    	{
    		m_Type = GL_RGB;
    		m_NbComp = 3;
    .
    .
    .
    }
    
    //This function return false because file dosen't exist.
    Boolean LoadBMP(BMP_24bits & BMP, const char * BMPFileName)
    {
    	FILE			*fichier;
    	unsigned char	Header[0x36];
    	unsigned int	DataPos,DataSize;
    	int				Components;
    	long			NbPixels;
    	int				rest,i,offset;
    	unsigned int	linesize;
    	
    //Read file and header
    	fichier = fopen(BMPFileName,"rb");if (!fichier) return false;
     .
     .
     .
    }
    I don't know what to search in the MSDN, this bug is too weird!

    By the way, I've rebuild all my code just to be sure that it wasn't a bad compilation problem.

    Thanx for the help!
    Last edited by bibiteinfo; 02-06-2006 at 12:07 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. non-lvalue error
    By zlb12 in forum C Programming
    Replies: 1
    Last Post: 04-17-2009, 10:43 AM
  2. Another syntax error
    By caldeira in forum C Programming
    Replies: 31
    Last Post: 09-05-2008, 01:01 AM
  3. BIG problem. How do I find a bug in so much code?
    By Yarin in forum C++ Programming
    Replies: 44
    Last Post: 01-31-2008, 12:39 PM
  4. One quick question...
    By Kross7 in forum C++ Programming
    Replies: 10
    Last Post: 04-13-2007, 09:50 PM
  5. C++ FTP class won't work
    By lord mazdak in forum C++ Programming
    Replies: 8
    Last Post: 12-18-2005, 07:57 AM