Thread: problem w/ class methods

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    May 2005
    Location
    Toronto, Canada
    Posts
    257
    I've taken a look at the code a bit and I can't find where the memory is leaking. Also, the print statement do nothing now. The ourput file contains nothing after the function runs. Would a memory leak affect the printing?
    In debug mode I get an access violation at the closing bracket of a function. It says NTDLL.... Access Violation.
    The function that fails is here:
    Code:
    FileBrowse::ResetFpath("recording:[000000]");
    
    	int radioState =0; 
    	char location = 'N';
    	char buffer[100];
    	FileBrowse ConnectFile;
    	CString localfile;
    
    	CButton* pRadio = (CButton*)GetDlgItem(IDR_TO); 
    	radioState = pRadio->GetCheck();
    
    	if(radioState)
    		location = 'T';
    
    	radioState = 0;
    
    	pRadio = (CButton*)GetDlgItem(IDR_MO); 
    	radioState = pRadio->GetCheck();
    
    	if(radioState)
    		location = 'M';
    
    	radioState = 0;
    
    	pRadio = (CButton*)GetDlgItem(IDR_LO); 
    	radioState = pRadio->GetCheck();
    
    	if(radioState)
    		location = 'L';
    	
    	CInternetSession isession;
    
    	CFtpConnection* pConnect;
    	CString Server;
    
    	InBAF::SetLocation(location);
    	InBAF::SetServerName(location);
    	Server = InBAF::GetServerName();
    
    	pConnect = isession.GetFtpConnection(_T(Server), "USER");
    	
    	pConnect->SetCurrentDirectory("recording:[000000]");
    	
    			FILE *out = fopen("H:\\GUI\\testInet-main.txt", "w");
    
    	CFtpFileFind finder(pConnect);
    
    	// Find  the first file 
    	BOOL bWorking = finder.FindFile(NULL);
    	CString rfname, nfname;
    	
    	// Go through the rest of the directory and designate files.
    	while (bWorking)
        {
    		bWorking = finder.FindNextFile();
    
    		rfname = finder.GetFilePath();
    
    		if (strstr(rfname, ".LSH"))
    		{
    			nfname = ConnectFile.MakeName(rfname);
    			fprintf(out, "\t\t\tSub: %s\n", nfname);
    		}
    		else if(strstr(rfname, ".DIR"))
    		{
    			nfname = ConnectFile.MakeName(rfname);
    			fprintf(out, "\t\t\tMain: %s\n", nfname);
    		}
    
    		rfname.Empty();
    		nfname.Empty();
    
    	}
    When I step to the red bracket I get the error.
    Last edited by earth_angel; 08-30-2005 at 07:08 AM.
    Everything is relative...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 08:18 PM
  2. Class design problem
    By h3ro in forum C++ Programming
    Replies: 10
    Last Post: 12-19-2008, 09:10 AM
  3. Message class ** Need help befor 12am tonight**
    By TransformedBG in forum C++ Programming
    Replies: 1
    Last Post: 11-29-2006, 11:03 PM
  4. Replies: 3
    Last Post: 10-31-2005, 12:05 PM
  5. Replies: 3
    Last Post: 12-03-2001, 01:45 PM