Well, it seem that I figured out something else in the meanwhile, but for MSVC version, I have MSCV++ .NET... Well, so my piece of code comes from a class I was building, that looks something like this:
Code:
class Image {
private:
UINT Width,
Height,
*Pixels;
public:
Image() {
Pixels = 0;
}
void Load_Image(string File_Name)
{
ifstream File;
File.open(File_Name.c_str(), std::ios::in | std::ios::binary);
File.read((char*)&Width, 4);
File.read((char*)&Height, 4);
delete[] Pixels;
Pixels = new UINT[Width * Height];
//all sort of other things...
}
};
Note that I have only placed the beggining of the loading function, not to worry with all my other lines. So what I'm doing is a kind of image class, to load image in a file that I create myself, just for learning purposes... So I placed a "delete[]" where it should be when you would need to load a second image, just deleting in the same time the previous one stored in memory. Altough that some people would prefer placing the delete in another class's method, I just wanted to leave it there...
So this works to what I have concluded if the project is done in "debug" options, or under "release", if and only if the constructor is called AND if the class is used with a pointer. To all other tries I made, I get a "user breakpoint error at the "delete" line...