|
Thanks.. Can I have a code snippet for performing structured exception handling..
|
|
|
|
|
Possibly documentation [^] helps.
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]
|
|
|
|
|
CPallini wrote: Possibly documentation helps.
Not when left unread
|
|
|
|
|
Plz give code urgent plz plz.
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]
|
|
|
|
|
Why not write your own.
Just set up a try/catch block and a for loop which reads each byte in the range. return true from the catch, or false if it terminates in the try block. IsBadWritePtr goes similar, just try to write the selfsame byte back to where it was read from.
Regards,
Bram van Kampen
|
|
|
|
|
Why not just crash? See here[^].
Steve
|
|
|
|
|
Hey everybody!
Does anyone know where can I find the domain controller SID in the WMI (XP) ???
Thanks!
|
|
|
|
|
Look at Win32_NTDomain class in WMI. It has among other these members.
string DomainControllerAddress;
int32 DomainControllerAddressType;
string DomainControllerName;
string DomainGUID;
string DomainName;
-Saurabh
|
|
|
|
|
Hey, Thanks for your help!
But I need SID, which is not found over there...
|
|
|
|
|
Okay, found it.
If we will take a look for at Win32_Group (it can be done in other ways, that is just one of them), all the groups that belong to the domain has the same SID prefix.
This prefix is the domain's SID!
Ta-Da!
Have Fun!
|
|
|
|
|
Great! Thanks for sharing.
-Saurabh
|
|
|
|
|
the application i am using requires the uncompressed tiff file having bit depth 1 and resolution of 300dpi. it is built in dot net 2003. whenever i open the uncompressed tiff image having bit depth 1 and save the same tiff image using savefiledialog function of dot net2003, the uncompressed tiff file becomes compressed and the bit depth is increased to 32. i haven't use any compression function. the code of saving the file is given below
private: void saveImageFile()
{
saveImage->Filter= "Tiff files (*.tif)|*.tif" ;
saveImage->FilterIndex = 1 ;
saveImage->RestoreDirectory = true ;
System::Windows::Forms::DialogResult d = this->saveImage->ShowDialog();
if (d == System::Windows::Forms::DialogResult::OK)
{
// creating a bitmap
Bitmap* saveMyImage;
saveMyImage=new Bitmap(this->pictureBox1->Image);//,System::Drawing::Imaging::PixelFormat::Format1bppIndexed);
saveMyImage->SetResolution(300,300);
saveMyImage->PixelFormat::Format1bppIndexed;// this line doesnot work
saveMyImage->Save(saveImage->FileName,System::Drawing::Imaging::ImageFormat::Tiff);
}
}
|
|
|
|
|
I think you better ask the managed C++/CLI forum [^].
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]
|
|
|
|
|
|
My lecturer require me to use char for string.
I include the string.h header file for my program.
I have a pointer variable by using the following code.
<br />
char *abc[10][10];<br />
char *def[10];<br />
After I initialize *def[], I enter the following code.
<br />
int n=0;<br />
strcpy(*abc[n],*def);<br />
After I enter the code above, my program crash. Why?
|
|
|
|
|
I really can't tell what you're trying to do with the above code - whether there's a single thing out of place, or if the whole thing is ass-about.
See, you've declared two arrays of pointers - you then start copying the strings pointed to by the pointers in the def array into the memory locations pointed to by the abc array, although you never actually allocate any memory for the string. - What does abc[0][0] point at? That's where you're trying to copy a string to. - Plainly put, you most likely don't own the memory that abc's elements are pointing at, hence the crash. - try removing the malloc statement then seeing what happens - seem familiar?
Here - some code that will hopefully do a better job of explaining this than I fear I am doing atm.
int main()
{
char *abc[10][10];
char *def[10];
int i = 0;
def[0] = "String 0";
def[1] = "String 1";
def[2] = "String 2";
def[3] = "String 3";
def[4] = "String 4";
def[5] = "String 5";
def[6] = "String 6";
def[7] = "String 7";
def[8] = "String 8";
def[9] = "String 9";
printf("Method 1 - copy strings themselves\n");
printf("----------------------------------\n");
for (i=0; i<10; i++)
{
abc[0][i] = malloc(strlen(def[i])+1);
strcpy(abc[0][i], def[i]);
}
for (i=0; i<10; i++)
{
printf("%s\n", abc[0][i]);
free(abc[0][i]);
abc[0][i] = NULL;
}
printf("\n\n");
printf("Method 2 - just copy pointers to the strings\n");
printf("--------------------------------------------\n");
for (i=0; i<10; i++)
{
abc[0][i] = def[i];
}
for (i=0; i<10; i++)
{
printf("%s\n", abc[0][i]);
}
}
|
|
|
|
|
cshong wrote: After I initialize *def[], I enter the following code.
Please post the initialization code.
BTW did you initialize abc as well?
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]
|
|
|
|
|
Hey all,
I got a big C++ interview coming up....and I am arrogant and think I am a C++ god...so see if you can stump my knowledge of the language. I solemnly swear I won't cheat and look up the answer, and you can feel free to rip me a new one in your responses. The only requirement is that you can't include anything about particular libraries or interfaces that aren't intrinsic to C++ (stl stuff is ok). The interview won't include things like that or other trivialities which can simply be referenced. They will be asking me things like "name the 3 ways you can blah blah" or "how could the following code be improved...what is the security or memory problem...what weaknesses does it have etc"
Show me what you got! Put me in my place and make me feel like I am going into this interview a lot dumber than I think!
Thanks to all who decide to participate...I owe you one.
|
|
|
|
|
andersod2 wrote: I solemnly swear I won't cheat and look up the answer
How can honesty be expected from such an arrogant and possibly egoistic person?
-Saurabh
|
|
|
|
|
takes one to know one brother...if you don't have the goods, save the philosophy lesson for somebody else.
|
|
|
|
|
Hey god, this forum is full of peaple asking help on C++ : try to answer their questions.
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]
|
|
|
|
|
Regards.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
how can a master of something be arrogant?
being humble is the first step to learn. if you think you're really good, you'll stop wanting to learn because you think you know it all...
i guess it's time to stop looking at the mirror and look at the world...
|
|
|
|
|
and btw, if you're a god, try to help me at my question about classes and events that i posted here on the forum... that would be of a great help to me
thank you
|
|
|
|
|
Nope, no god here - must have been another one of those cults.
|
|
|
|