Object that writes itself

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
delvinAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
nietodConnect With a Mentor Commented:
No there is no limit to the number of bytes that can be written.   you've got a bug.  If you post the code I might be able to help you.
0
 
nietodCommented:
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.
0
 
delvinAuthor 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
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.