We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

Object that writes itself

delvin
delvin asked
on
Medium Priority
231 Views
Last Modified: 2010-04-01
I have an object that writes out about 950 bytes in total to a file.  When I compile a release version of the program the object starts to write random garbage to the file inbetween the values.  If I change one of the charater arrays in the object  from 450 to 300, it works again.   My question is, is there a limit to the number of bytes that can be written to a file using outfile.write( (char*)this, sizeof(*this)) in realease mode ???  Is there another way to write this object to the file?  It is a console appliation compiled under VC++ 5.0 SP3
Comment
Watch Question

Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Commented:
Note that in general this is not the best way to read and write objects (unless these objects obey certain restrictions.)  However, why don't you post your code before we worry about that.

Author

Commented:
I figured it out.  The object that was passing information to the one I was having problems with was not initializing the data correctly.  

Dooo! :)

Thanks
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.