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:When I step to the red bracket I get the error.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(); }