|
Change
FILE *fp=fopen("input.txt","r");
FILE *fp1=fopen("output.txt","w"); to
FILE *fp=fopen("input.txt","rb");
FILE *fp1=fopen("output.txt","wb");
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
How large should and exe file be. A have a program that's currently pushing 1.21 MB and will only get bigger. Is it better if I start putting some code into dll's for better load time at startup? What are the pro's and cons of using dll's?
|
|
|
|
|
Under Windows NT and its successors, the size of the .EXE really doesn't matter. Windows uses the processor's paging mechanism to load pages out of the .EXE as needed.
Also, unless you load your DLL's 'manually' using LoadLibrary and GetProcAddress , DLL's are loaded implicitly. This means that they essentially get loaded with you .EXE when it starts. For that reason, breaking code out into DLL's isn't going to help your startup time.
Given that your .EXE is only 1.21MB, I wouldn't bother worrying about the load time.
Software Zen: delete this;
|
|
|
|
|
For that reason, breaking code out into DLL's isn't going to help your startup time.
... unless you are using DELAYLOAD linker switch.
"...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..."
Me
|
|
|
|
|
True, but given the tone of the question, I didn't think delay loading was an issue.
Software Zen: delete this;
|
|
|
|
|
This time I don't make too many iterations or so through the array. Now in the first iteration it crashes when I delete:
for(int i = 0; i < m_nCount; i++)
{
char* lowercase = new char[strlen(m_pStack[i])];
strcpy(lowercase, m_pStack[i]);
_strlwr(lowercase);
if(strcmp(keyword, lowercase) == 0)
{
ret = i;
break;
}
delete [] lowercase;
}
Rickard Andersson
Here is my card, contact me later!
UIN: 50302279
Sonork: 37318
|
|
|
|
|
You need to add room for the '\0' terminator:
char* lowercase = new char[strlen(m_pStack[i]) + 1];
Software Zen: delete this;
|
|
|
|
|
But still, that does not explain the crash where the string is deleted.
--
They're out get me, I can't escape cos' they won't let me
They won't forget me, they'll get me in their grip and sweat me
They'll wait me out, and then move in under my skin
They'll make me doubt, they're out to make me let them in
|
|
|
|
|
It's not a crash, it's an assertion failure. The CRT is telling you that you wrote past the end of the memory block that you allocated.
Here's how it works. When you new some memory, say 10 bytes, the CRT allocates more for its own use. So you'll get back something like this:
$$$$..........$$$$
^
|
returned pointer Where the dots are your 10 bytes, and the $ are the extra memory. The $ bytes are set to 0xFD. When you delete the pointer, the CRT checks the $ bytes again, and if they are not all 0xFD, it asserts to let you know that you have an underrun/overrun error in your code.
--Mike--
Ericahist [updated Oct 26] | CP SearchBar v2.0.2 | Homepage | RightClick-Encrypt | 1ClickPicGrabber
Pinky, are you pondering what I'm pondering?
I think so Brain, but if we shaved our heads, we'd look like weasels!
|
|
|
|
|
Yeah, I remember now. This buffer overrun detection is new in VS.NET isn't it?
I don't do buffer overruns...
--
They're out get me, I can't escape cos' they won't let me
They won't forget me, they'll get me in their grip and sweat me
They'll wait me out, and then move in under my skin
They'll make me doubt, they're out to make me let them in
|
|
|
|
|
|
Ah yes. 0xfefefefe, 0xcdcdcdcd IIRC correctly. I use this values every time when I debug but I never reflected on that the compiler adds padding information. Thanks for the info
--
Here we come, reach for your gun
And you better listen my friend, you see
It's been slow down below,
Aimed at you, we're the cowboys from hell
|
|
|
|
|
Jörgen Sigvardsson wrote:
I don't do buffer overruns...
Yeah yeah yeah, riiiight!
Rickard Andersson
Here is my card, contact me later!
UIN: 50302279
Sonork: 37318
|
|
|
|
|
Actually it's been quite a while since I had such problems. Mostly because I'm a) vigilant, and b) I use proven classes which handle all low level operations such as memory allocation and stuff.
Most of the troubles I've had recently have been reference counting on COM-interfaces. Actually, the last such a problem was not introduced by me, but by a colleague. I guess I'll fix that tomorrow, so that the damn out-of-proc server may terminate properly
--
Here we come, reach for your gun
And you better listen my friend, you see
It's been slow down below,
Aimed at you, we're the cowboys from hell
|
|
|
|
|
Cool! Thank you so much for that information!
Rickard Andersson
Here is my card, contact me later!
UIN: 50302279
Sonork: 37318
|
|
|
|
|
Michael Dunn wrote:
Ericahist [updated Oct 26]
The new red-shirt pics look very similar to the bright blue pics.. Especially the "surprised!" look ones... Is that intentional?
And now I've got to add 2 more pics to my collage...
The kindest thing you can do for a stupid person, and for the gene pool, is to let him expire of his own dumb choices.
[Roger Wright on stupid people]
We're like private member functions
[John Theal on R&D]
We're figuring out the parent thing as we go though. Kinda like setting up Linux for the first time ya' know...
[Nitron]
|
|
|
|
|
No, not intentional. I just take some screen caps as the show plays, then I go back after the show's done and pick out the nicest-looking ones.
--Mike--
Ericahist [updated Oct 26] | CP SearchBar v2.0.2 | Homepage | RightClick-Encrypt | 1ClickPicGrabber
Kosh reminded me of some of the prima-donna programmers I've worked with. Knew everything but when you asked them a question; never gave you a straight answer.
-- Michael P. Butler in the Lounge
|
|
|
|
|
Michael Dunn wrote:
No, not intentional. I just take some screen caps as the show plays
Ok... so I gotta get in on this. When, Where? So I don't have to be a beggar to your screencaps. ;P
The kindest thing you can do for a stupid person, and for the gene pool, is to let him expire of his own dumb choices.
[Roger Wright on stupid people]
We're like private member functions
[John Theal on R&D]
We're figuring out the parent thing as we go though. Kinda like setting up Linux for the first time ya' know...
[Nitron]
|
|
|
|
|
It's not magic or anything. I use WMP 9 and turn off video acceleration (otherwise a screen cap wouldn't capture the video window). Then I set up Paint Shop Pro to do multiple screen captures with a hotkey (F11 or something like that). Then I watch the show
--Mike--
Ericahist [updated Oct 26] | CP SearchBar v2.0.2 | Homepage | RightClick-Encrypt | 1ClickPicGrabber
Pinky, are you pondering what I'm pondering?
I think so Brain, but if we shaved our heads, we'd look like weasels!
|
|
|
|
|
You could use _stricmp() instead. That way you don't have to allocate a new string.
for(int i = 0; i < m_nCount; ++i) {
if(_stricmp(keyword, m_pStack[i]) == 0) {
ret = i;
break;
}
}
--
They're out get me, I can't escape cos' they won't let me
They won't forget me, they'll get me in their grip and sweat me
They'll wait me out, and then move in under my skin
They'll make me doubt, they're out to make me let them in
|
|
|
|
|
You made my Find() method much more sexy now, you know that?
Rickard Andersson
Here is my card, contact me later!
UIN: 50302279
Sonork: 37318
|
|
|
|
|
Screenshots! Screenshots!
--
The coolest game in the world: NHL Hockey[^]
|
|
|
|
|
While applying SP5 to Visual Studio 6 I repeatedly received an error, to the effect of "C:\Windows\System32\MSVCP60.dll could not be opened" yet when the installation was complete it reported that SP5 had been successfully installed. Since this is the updated (for VS6) C++ Runtime Library, should I be concerned? Searching shows that there are 4 copies of this dll on the C: drive, all of the same version, but none exists in ...\System32\. Should I ignore it, or make a copy and drop it in the System32 folder? Or is this just an error on the part of the installer program, looking for a file on C: even though I specified a different installation location? The correct version does exist in ...\vc98\redist. Thoughts, anyone?
"Your village called - They're missing their idiot."
|
|
|
|
|
Sounds like some other application had the file locked. I'd be tempted to go ahead and try replacing it manually, probably with a reboot beforehand. Good luck.
Software Zen: delete this;
|
|
|
|
|
Why can't I remove the window style WS_CLIPSIBLINGS? If I remove this style using ModifyStyle, it will be there again afterwards. Why?
|
|
|
|