943,754 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 3447
  • C++ RSS
You are currently viewing page 2 of this multi-page discussion thread; Jump to the first page
Aug 19th, 2008
0

Re: Need to write an integer to a binary file

>>Error E2034 binaryfilewriting.cpp 64: Cannot convert 'int *' to 'const char *' i

>> out.write(&counter, sizeof(int));
That should have been typecast, like this:
out.write((char*)&counter, sizeof(int));
This is writing some unwanted character to the binary file. I have opened the file in Edit Plus.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
mksakeesh is offline Offline
17 posts
since Aug 2008
Aug 19th, 2008
0

Re: Need to write an integer to a binary file

Click to Expand / Collapse  Quote originally posted by mksakeesh ...
This is writing some unwanted character to the binary file. I have opened the file in Edit Plus.
Of course it does -- afterall that's what a binary file looks like. google for definition of binary file See post #5 above.
Last edited by Ancient Dragon; Aug 19th, 2008 at 9:18 am.
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,950 posts
since Aug 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: geany and tags
Next Thread in C++ Forum Timeline: Matrix - Matrix multiplication





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC