|
When I compiled the following very simple "c" code in Release mode, VC++ 6.0 compiler is giving the INTERNAL COMPILER ERROR error. Can anybody tell me why this happens.
/*test.c*/
void main()
{
__int64 a=0, b=0;
do
{
int c = a-b ? a-b : 0;
b = c;
}while(b);
}
Thanks
Shino
|
|
|
|
|
Do you get any different result if you change the file's extension to CPP?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
No problem. But still compiler is showing the same error.
|
|
|
|
|
What compiler are you using? Other than a C4244 warning, I compiled it just fine with VS6. Have you read this?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Do you have the latest visual C++ 6.0 service pack installed? The latest one is Service pack 6 . You could find it here[^].
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
i need convert image bitmap 8bits to image bitmap 24bits or convert image bitmap 8bits to file pcl. thanks very much
|
|
|
|
|
To convert from 8-bits to 24-bits simple copy the value from 8-bit image to all 3 channels in the 24-bits image.
-Saurabh
|
|
|
|
|
Saurabh.Garg wrote: copy the value from 8-bit image to all 3 channels in the 24-bits image.
Are you sure?
|
|
|
|
|
Yes, why? Would you do it any other way?
-Saurabh
|
|
|
|
|
8 bitimages are normally having a color palette where the actual color is stored. And the index to that color array is stored as pixel info (that is the 8bit).
|
|
|
|
|
don't know. can you tell specific ?
|
|
|
|
|
can you tell technical raster when process image bitmap 8bits ?
|
|
|
|
|
In general, for 8 bit images there will be a color palette. And each pixel is stored as 8 bit data. But it will not be the actual color. Instead it will be an index of the color palette. Since one pixel is stored with 8 bit data, there can be a maximum of 256 colors. The color palette is having the RGB info of these 256 colors.
Hope it is clear to you.
I am not sure about typical monochrome images.
Like the 8 bit image there are 4 bit images also. In that the pixel is stored with 4 bit pixel info and it is the index of the color palette of maximum of 16 colors.
|
|
|
|
|
you convert DrawImage_24Bits() to DrawImage_8Bits() for help me ?. wish your help. thanks very much
void DrawImage_24Bits()
{
string cmd = "";
int i = 0, j = 0;
long x= 0, y =0, nbytes = 0, pos = 0, nbyteR =0;
x = m_biWidth*3;// * 2.875;
y = m_biHeight*3;// * 2.875;
nbyteR = (((m_biWidth * m_biBitCount + 31) & ~31) >> 3);
nbytes = (((x * m_biBitCount + 31) & ~31) >> 3);
y = abs(y);
cmd += STAR; cmd += lib;
m_objPrint->PrintPclCommand(cmd.c_str(), UIM, 0);
int zerobit= nbytes - x;
buf = new char[nbyteR * m_biHeight];
int num_read = fread((void*)buf, sizeof(char), (nbyteR * m_biHeight), f_bmp);
m_sizeimage = nbytes * y;
ResizeBuffImage(buf, num_read, x);
pos = m_sizeimage - nbytes;
int Byte = 0;
for (j = 0; j < y; j++)
{
Byte = 0;
m_objPrint->PrintPclCommand(cmd.c_str(), UIW, nbytes);
for ( i = 0; i < x; i++)
{
m_objPrint->Print(bufR[pos + Byte++]);
m_objPrint->Print(bufR[pos + Byte++]);
m_objPrint->Print(bufR[pos + Byte++]);
}
if(zerobit >0)
for(int tt = 0; tt < zerobit ; tt++)
m_objPrint->Print(0);
pos -= nbytes;
}
}
void ResizeBuffImage(const char *buff, long size, long width)
{
long nbyteR = (((m_biWidth * m_biBitCount + 31) & ~31) >> 3);
long count = 0, w = width, j = 0, tempw = 0;
int redubit= size - m_biWidth * m_biHeight;
if (redubit > 0 && redubit % m_biWidth == 0)
redubit /= m_biWidth ;
bufR = new char[m_sizeimage]; //size * 9
for (long i = 0; i < size; i+=3)
//for (long i = 0; i < size; i++)
{
bufR[count++] = buff[i];
bufR[count++] = buff[i+ 1];
bufR[count++] = buff[i+ 2];
bufR[count++] = buff[i];
bufR[count++] = buff[i+ 1];
bufR[count++] = buff[i+ 2];
bufR[count++] = buff[i];
bufR[count++] = buff[i+ 1];
bufR[count++] = buff[i+ 2];
if ((count + redubit) % (w + redubit) == 0)
{
for (int m = 0; m< redubit; m++)
{
bufR[count++] = buff[i+3+m];
i++;
}
//copy width image to three times
//for (int times = 0; times < 2; times++)
for (int times = 0; times < 2; times++)
{
tempw = count;
for ( j = count - (w + redubit) ; j < tempw ; j++ )
{
bufR[count++] = bufR[j];
}
}
}
}
}
}
|
|
|
|
|
Well... the following is a general purpose code that read bitmap data. It was done some years back but you can refer this to modify your code for 8 bit images.
Hope this is useful.
void CBMPDlg::OnShowStructData()
{
CFileDialog dlg( TRUE, "bmp", 0, OFN_HIDEREADONLY | OFN_FILEMUSTEXIST, "BMP Files (*.bmp)|*.bmp|", this );
if( IDCANCEL == dlg.DoModal())
{
return;
}
CString csData = dlg.GetPathName();
CFile file( csData, CFile::modeRead );
csData += "\r\n\r\nStructural Data\r\n";
BITMAPFILEHEADER stBFH = { 0 };
file.Read( &stBFH, sizeof( stBFH ));
CString csStr;
csData += "\r\nBITMAPFILEHEADER\r\n";
csStr.Format( "bfType - %c%c\r\n", stBFH.bfType & 0xFF, ( stBFH.bfType >> 8 ) & 0xFF );
csData += csStr;
csStr.Format( "bfSize - %lu\r\n", stBFH.bfSize );
csData += csStr;
csStr.Format( "bfReserved1 - %u\r\n", stBFH.bfReserved1 );
csData += csStr;
csStr.Format( "bfReserved1 - %u\r\n", stBFH.bfReserved1 );
csData += csStr;
csStr.Format( "bfOffBits - %u\r\n", stBFH.bfOffBits );
csData += csStr;
BITMAPINFOHEADER stBIH = { 0 };
file.Read( &stBIH, sizeof( stBIH ));
csData += "\r\nBITMAPFILEHEADER\r\n";
csStr.Format( "biSize - %lu\r\n", stBIH.biSize );
csData += csStr;
csStr.Format( "biWidth - %ld\r\n", stBIH.biWidth );
csData += csStr;
csStr.Format( "biHeight - %ld\r\n", stBIH.biHeight );
csData += csStr;
csStr.Format( "biPlanes - %u\r\n", stBIH.biPlanes );
csData += csStr;
csStr.Format( "biBitCount - %lu\r\n", stBIH.biBitCount );
csData += csStr;
csStr.Format( "biCompression - %lu\r\n", stBIH.biCompression );
csData += csStr;
csStr.Format( "biSizeImage - %lu\r\n", stBIH.biSizeImage );
csData += csStr;
csStr.Format( "biXPelsPerMeter - %lu\r\n", stBIH.biXPelsPerMeter );
csData += csStr;
csStr.Format( "biYPelsPerMeter - %lu\r\n", stBIH.biYPelsPerMeter );
csData += csStr;
csStr.Format( "biClrUsed - %lu\r\n", stBIH.biClrUsed );
csData += csStr;
csStr.Format( "biClrImportant - %lu\r\n", stBIH.biClrImportant );
csData += csStr;
if( stBIH.biBitCount <= 8 )
{
const int nSize = 1 << stBIH.biBitCount;
RGBQUAD* arRGB = new RGBQUAD[nSize];
file.Read( arRGB, nSize * sizeof( RGBQUAD ));
csData += "\r\nRGBQUAD Array\r\n";
for( int n = 0; n < nSize; n++ )
{
csStr.Format( "%02X %02X %02X %02X\r\n", arRGB[n].rgbBlue,arRGB[n].rgbGreen,
arRGB[n].rgbRed, arRGB[n].rgbReserved );
csData += csStr;
}
delete[] arRGB;
}
else
{
csData += "\r\nRGBQUAD Array\r\nNone\r\n";
}
const int nSize = stBFH.bfSize - stBFH.bfOffBits;
BYTE* arByte = new BYTE[nSize];
file.Read( arByte, nSize );
csData += "\r\nImage Data\r\n";
for( int n = 0; n < nSize; n++ )
{
csStr.Format( "%02X ", arByte[n] );
csData += csStr;
}
delete[] arByte;
SetDlgItemText( IDC_EDIT_DATA, csData );
}
|
|
|
|
|
that only works if the 8-bit image is grayscale.
|
|
|
|
|
can you tell specific ? are you there are documents for it ?
|
|
|
|
|
Hello, I have a weired problem...
I have a CTime object called t and my fuction supposed to add one day to this object, it works perfectly until it gets to the date "October 5th 2008" (5/10/2008) and then it is giving me the same date (without adding it one day)
Here is the code (t is the date we want to enlarge)
CTimeSpan ts (1,0,0,0);
CTime t2= t + ts;
return t2;
|
|
|
|
|
Check the input date's time, if it is 00:00:00 strange things happen.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Thanks, I changed it and it works now
|
|
|
|
|
You are welcome.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hello,
I am working on an mfc application in which there is a colour code being fetched from the server stored in a CString. The colour code is in Hexadecimal for eg #3333FF
Now I want to set the backgroung of my control based on this color. For that I want to change the color in RGB.
I am using the following code but it is not working properly.
Please tell whats the problem.
LPTSTR pStop;
int b1,b2,b3;
CString str("#3333FF");
LPCTSTR input= str;
int num = _tcstol(input + 1, &pStop, 16);
b1 = (num & 0xFF0000) >> 16;
b2 = (num & 0xFF00) >> 8;
b3 = num & 0xFF;
COLORREF crBkgnd = RGB(b1 ,b2 ,b3 );
But the above code is making the value of b1,b2 and b3 to 0.
As a result my control background is always colured in white.
Please help me.
Thanks In Advance.
Dhiraj
|
|
|
|
|
Actually your code is working fine on my system.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Can you tell me what can be the possible reason that its not working on my system.
|
|
|
|
|
I suppose your debugger can tell it far better than me.
Debug it, step by step and see at what line the toy starts to break, then, optionally ask our help about.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|