1. Deleting files that are being held by a program
2. Open previously opened serialized file != new open serialize file
3. How to delete pointers held inside a vector
Hi,
I have a class named MC.
Header contains the following:
struct tCDV
{
int intC
long lngR;
bool blnE;
CString strC;
};
tCDV* p_cDV;
const int BUFF_SIZE;
std::vector<tCDV*> m_cDV;
Unit contains the following:
MC::MC():
BUFF_SIZE(32)
{
}
MC::Test()
{
p_cDV = new tCDV[BUFF_SIZE];
p_cDV->intC = cc; //cc initialised elsewhere in program
p_cDV->lngR = cr; //cr initialised elsewhere in program
p_cDV->blnE = file.read_bool(); // file.read_bool() initialised elsewhere
in program
p_cDV->strC = file.read_string(); // file.read_string() initialised
elsewhere in program
m_cDV.push_back(p_cDV);
}
All the above works fine. My problem is that I receive memory leaks on
program exit and the debugger points to:
p_cDV = new tCDV[BUFF_SIZE];
I attempted to iterate through the vector: m_cDV (via the destructor of
class MC), deleting the pointers p_cDV but to no avail. So, I scrapped the
iteration code.
Please can someone assist me in resolving this problem.
Thanks.
Colin
4. Force File.Delete() to Delete "in use" file - CSharp/C#
5. how to hold a console application open
Hello, How do I hold a console application open in C#? Thanks, Ron
6. Opening a File using "File.Open" - CSharp/C#
7. CFile::Open doesnt open already opened MSWord File
Hi,
I am facing a problem.
I am trying to open a MS Word file using CFile::Open method. It works
fine when file is not opened. But when that MSWord file is already
opened, the CFile::Open function doesnt not open the file and return
zero.
Is it anything to do with the File Open mode i am specifying?
here is the code i am trying to execute--
CFile f1;
CFileException fe;
int nFileException = 0;
CString sFileName = "C:\\TestFile.doc";
BOOL b1 = f1.Open(sFileName,CFile::shareDenyNone,&fe);
if(b1)
{
f1.Close();
nFileException = 0;
}
else
nFileException = fe.m_cause;
Please help. I am stuck at this point.
Thanks!
Gurvinder
8. Problem opening serialized file via Open command associated with file type