|
-
January 3rd, 2013, 06:00 PM
#4
Re: ofstream writing replaces entire file with 0s
 Originally Posted by fiodis
The code runs without crashing,
Code:
char bytesToWrite[2];
//...
delete[] bytesToWrite;
This does not "run fine". You are calling delete[] on a pointer that was never initialized with new[]. Once that illegal line is executed, the behaviour of the program becomes undefined.
Regards,
Paul McKenzie
Last edited by Paul McKenzie; January 3rd, 2013 at 06:04 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|