![]() |
| | #1 |
| Registered User Join Date: May 2005 Location: Toronto, Canada
Posts: 257
| FtpFileFind access violation with MS VC++ 6.0 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("*"));
__________________ Everything is relative... |
| earth_angel is offline | |
| | #2 |
| Registered User Join Date: Aug 2005
Posts: 1,265
| is pConnect a NULL pointer? |
| Ancient Dragon is offline | |
| | #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 | |
| | #4 |
| Skunkmeister 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 | |
![]() |
| Thread Tools | |
| Display Modes | |
|
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 |