Solved

Object that writes itself

Posted on 1998-06-02
3
191 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
0
Comment
Question by:delvin
  • 2
3 Comments
 
LVL 22

Accepted Solution

by:
nietod earned 100 total points
ID: 1165148
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
 
LVL 22

Expert Comment

by:nietod
ID: 1165149
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
 

Author Comment

by:delvin
ID: 1165150
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

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
object modeling - load and save functions 5 61
computer science syllabus 3 83
Using Diagnostic tools in VS2015: Unresoved allocations 19 86
White board coding practice 3 88
When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question