| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
A "." in a char* crashes it
Hi, i have a very simple problem that im pulling my hair out over!
In the CPU debug window it stops at "mov ebx,[ebx+0x04]" when it stops, the ebx register is empty, just shows 00000000 It works fine in the built .exe just not when i run it from borland, but i dont want memory leaks, etc in the final version I've never had this problem before, it doesnt even seem to make sense ![]() Last edited by Rossss : August 6th, 2006 at 04:25 PM. Reason: extra info |
|
#2
|
||||
|
||||
|
Could you post the source code?
Preferably between [code] or [highlight=C++] tags :-)
__________________
This is my code. Is it not nifty? "The biggest problem encountered while trying to design a system that was completely foolproof, was, that people tended to underestimate the ingenuity of complete fools." ---Douglas Adams Join the Itsacon fanclub! Zero Tolerance: Spammers banned so far: 280
![]() |
|
#3
|
|||||
|
|||||
|
Sure, here it is;
C++ Code:
|
|
#4
|
||||
|
||||
|
Ah, problem found.
You can't just write a string to an uninitialized pointer!. Either declare it as Code:
char[256] path; or put a Code:
char = malloc(256 * sizeof(char)); It's a wonder your system hasn't BSOD'ed, you're writing the string to a completely random place in memory! |
|
#5
|
|||
|
|||
|
correction:
char path[256]; path = malloc(256 * sizeof(char)); |
|
#6
|
||||
|
||||
|
Quote:
Oops, you're right. Turned those around... That's what you get for posting in a rush, thanks for correcting me. ![]() |
|
#7
|
|||
|
|||
|
Excellent!
Thanks guys it works a treat, i thought it had to be some small silly thing i'd done, duh! ![]() |
![]() |
| Viewing: Dev Articles Community Forums > Programming > C/C++ Help > A . in a user entered char* crashes it |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|