|
deadlyabbas wrote: Example:
#Ifdef 1
cout<<"Hello World"<<endl;
#else
cout<<"have a="" nice="" day"<<endl;
#endif<="" blockquote="">
That's conditional compilation (compiler doesn't even 'see' the "Nice Day" statement, the preprocessor removes it).
deadlyabbas wrote: if(1)
cout<<"Hello World"<<endl;
else
cout<<"have a="" nice="" day"<<endl;<="" blockquote="">
That's runtime evaluation of statements.
Hint: compile with /E flag to see the preprocessor in action.
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 Sir,
How to read Byte array From image ?
in C# i can read perfect but in VC++ i dont know how to do it ?
Thanks !
|
|
|
|
|
raju_Code wrote: How to read Byte array From image ?
Do you mean from a GDI+ Image[^]?
Best Wishes,
-David Delaune
|
|
|
|
|
hi.
i want to write an image processing program and i don't need to preview the image so i decided to use win32 console application to avoid any unwanted delays. i want to use GDI+ classes but there is a runtime error.
my program :
#include "stdafx.h"
#include <windows.h>;
#include <gdiplus.h>;
using namespace Gdiplus;
int main()
{
Bitmap *bmp;
bmp = new Bitmap(L"my image path");
unsigned int w = bmp->GetWidth();
return 0;
}
the error :
Unhandled exception at 0x00411761 in GdiPlusTest.exe: 0xC0000005: Access violation reading location 0x00000004.
any help? thanks.
|
|
|
|
|
__erfan__ wrote: i want to write an image processing program and i don't need to preview the image so i decided to use win32 console application to avoid any unwanted delays.
Hey, you're in the un-managed world here.
Probably the bitmap object it is incorrectly built because you've not initialized, as required, the GDI+ library (MSDN [^]):
You must call GdiplusStartup before you create any GDI+ objects, and you must delete all of your GDI+ objects (or have them go out of scope) before you call GdiplusShutdown.
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]
|
|
|
|
|
ops... A photo finish. and you won
|
|
|
|
|
I'm pretty sure he has borrowed some of Rajesh's monkeys. He only slept 4 hours last night. He is training them to play chess.
Best Wishes,
-David Delaune
|
|
|
|
|
|
Randor wrote: I'm pretty sure he has borrowed some of Rajesh's monkeys
Randor wrote: He is training them to play chess.
I actually was persuading one of them (the most appealing female of the group) to have some ...
(well I suppose it's not sister kid safe)
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]
|
|
|
|
|
|
__erfan__ wrote: Unhandled exception at 0x00411761 in GdiPlusTest.exe: 0xC0000005: Access violation reading location
You have to initialize GDI+ before you make any GDI+ calls. check GdiplusStartup()[^] function
|
|
|
|
|
|
|
Looks like the missing initialization didn't pass unnoticed...
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]
|
|
|
|
|
Hi,
Please mark the correct answers(s) that helped you by clicking "Good Answer". I've done it for you now.
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
Hi,
i would like to know the best way to convert a char (e.g 'c') to its hex string representation (i.e 63) in c++ and save it to a file as such.
|
|
|
|
|
fprintf(fp, "%02X ", 'c');
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]
|
|
|
|
|
Thank you, but is there also a way to do it with ofstream or ostringstream?
So many streams are available, so confusing
|
|
|
|
|
Naturellement!
#include <fstream>
void main()
{
std::ofstream os;
os.open("foo.txt");
os.unsetf(std::ios_base::dec);
os.setf(std::ios_base::hex);
os << (int) 'c' << std::endl;
os.close();
}
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 again, another problem came up though. The character has reinterpret_cast<char*> in front of it and then the address of the vector element. The reinterpret_cast should to my opininon put the char in correct format, but it wont come out right
|
|
|
|
|
Could you please post sample code?
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]
|
|
|
|
|
Is there any way to differentiate programmatically which event is occuring i.e shutdown or restart after catching WM_QUERYENDSESSION??
Regards,
Kushagra
|
|
|
|
|
See the 'competitor' [^].
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 Sir,
It surely will help
Kushagra
|
|
|
|
|
Kushagra Tiwari wrote: It surely will help
Knowing how Windows was last shut down is helpful?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|