C Board  

Go Back   C Board > General Programming Boards > C++ Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 09-22-2005, 01:26 PM   #1
Registered User
 
Join Date: May 2005
Location: Toronto, Canada
Posts: 257
FtpFileFind access violation with MS VC++ 6.0

Hi everyone,

I have a problem that kept poping up in debug mode at the closing bracket of a function. I've tested each line of code adding one by one and running through it. Once I added the last line in this snipet I started getting the Access violation error. If I run the code I on't get the error, only in debug mode.
Code:
	int radioState =0; 
	char location = 'N';
	FileBrowse ConnectFile;
	CString localfile;

	CInternetSession isession;

	CFtpConnection* pConnect = NULL;
	CString Server;

	if(location == 'L')
	{
		CMyFileDialog  FileDlg(TRUE,0,0,OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT,0,this);
	
		if(FileDlg.DoModal() == IDOK)
		{
			localfile = FileDlg.GetPathName();
			CEdit* pEditSelFile = (CEdit*)GetDlgItem(IDE_FILEPATH);
	        pEditSelFile->SetWindowText(localfile);
		}

		InBAF::SetLocation(location);
		return;
	}
	else
	{
		InBAF::SetLocation(location);
		InBAF::SetServerName(location);
		Server = InBAF::GetServerName();
	}

	pConnect = isession.GetFtpConnection(_T(Server));
		
	//CMyConnection::InitConnection(pConnect);
	
	pConnect->SetCurrentDirectory("recording:[000000]");
		CListBox* pListMain = (CListBox*)GetDlgItem(IDLB_MAINDIR); 
	CListBox* pListSub = (CListBox*)GetDlgItem(IDLB_SUBDIR);

	
	//clear the listbox with folders
	pListMain->ResetContent();
	pListSub->ResetContent();

	CFtpFileFind finder(pConnect);
	
	// Find  the first file 
	BOOL bWorking = finder.FindFile(_T("*")); 
I'm not sure if there is something else that causes it, but before I put this line in I didn't get the access violation error. What access is the function violating?
__________________
Everything is relative...
earth_angel is offline   Reply With Quote
Old 09-22-2005, 02:32 PM   #2
Registered User
 
Join Date: Aug 2005
Posts: 1,265
is pConnect a NULL pointer?
Ancient Dragon is offline   Reply With Quote
Old 09-22-2005, 02:55 PM   #3
Registered User
 
Join Date: May 2005
Location: Toronto, Canada
Posts: 257
No, it's initiated to NULL, but then I assign it to
Code:
pConnect = isession.GetFtpConnection(_T(Server));
__________________
Everything is relative...
earth_angel is offline   Reply With Quote
Old 09-22-2005, 07:02 PM   #4
Skunkmeister
 
Stoned_Coder's Avatar
 
Join Date: Aug 2001
Posts: 2,572
(_T(Server));

Server is a variable not a string literal it doesnt need the _T macro. Consequently pConnect probably isnt what you thought it was. Maybe you should learn to use asserts.
__________________
Free the weed!! Class B to class C is not good enough!!
And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi
Stoned_Coder is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
access violation in int array George2 C Programming 2 08-02-2007 11:28 PM
Access violation when reading a string. Desolation C++ Programming 16 05-01-2007 10:25 AM
Error connecting from Dev C++ to MS Access Database Sridar C++ Programming 0 04-15-2006 06:09 PM
using DAO without MS Access installed zMan Windows Programming 2 02-20-2002 03:14 PM
0xC0000005: Access Violation Strider Windows Programming 3 11-07-2001 02:46 PM


All times are GMT -6. The time now is 04:11 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC2

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