hi, I'm writting a class in viual c++ 6.0, here're two of my functions
void CImagen::SetTamano(UINT m_Ancho, UINT m_Alto)
{
Ancho=m_Ancho;
Alto=m_Alto;
Data=new BYTE[Ancho*Alto];
}
BOOL CImagen::Binarizar(BYTE umbral)
{
UINT i,j,index;
BYTE b;
LPBYTE r=new BYTE[Ancho*Alto];
for (i=0;i<Ancho;i++){
for(j=0;j<Alto;j++){
index=j*Ancho+i;
b=Data[index];
if(b<=umbral)
r[index]=0;
else
r[index]=255;
}
}
delete [] Data;
Data=r;
return TRUE;
}
The first function works fine, the NEW statement works good, but in the second function the new statement returns always 0 or NULL.
Note:
Ancho=320
Alto=240
I think is has something to do with the memory available, does anyone have a solution???
void CImagen::SetTamano(UINT m_Ancho, UINT m_Alto)
{
Ancho=m_Ancho;
Alto=m_Alto;
Data=new BYTE[Ancho*Alto];
}
BOOL CImagen::Binarizar(BYTE umbral)
{
UINT i,j,index;
BYTE b;
LPBYTE r=new BYTE[Ancho*Alto];
for (i=0;i<Ancho;i++){
for(j=0;j<Alto;j++){
index=j*Ancho+i;
b=Data[index];
if(b<=umbral)
r[index]=0;
else
r[index]=255;
}
}
delete [] Data;
Data=r;
return TRUE;
}
The first function works fine, the NEW statement works good, but in the second function the new statement returns always 0 or NULL.
Note:
Ancho=320
Alto=240
I think is has something to do with the memory available, does anyone have a solution???