OFB Community Mailing Lists

The following archives are provided as a public service to the community. Opinions archived here do not necessarily represent the opinions of Open for Business or its contributors.

[CS-FSLUG] Binary

Aaron Patrick Lehmann lehmanap at cs.purdue.edu
Sun Dec 12 09:39:15 EST 2004


Did you set the 'b' mode flag on the stream when you opened it?

Aaron Lehmann

On Sun, Dec 12, 2004 at 01:29:09AM -0600, N. Thompson wrote:
> I read in one of my books that Qt keeps data separate by itself when you're 
> using binary output streams, I was trying to see if this would also happen 
> with regular C++ binary file streams so I was trying to test it out. I wrote 
> a program which would write three integers, three strings and then three 
> characters to a file but when I opened it I get a plain text file.
> 
> Can anyone explain why I'm getting what looks like an ordinary plain text 
> file, are characters and numbers not changed into something else when dealing 
> with binary file streams?
> 
> If anyone was wondering about the results, the standard C++ file streams do 
> not separate data given to a binary output stream, the output came out as 
> "123onetwothree123" where the first three numbers were the integers given to 
> it, the next three words were the strings and the last three numbers were the 
> characters.
> 
> _______________________________________________
> ChristianSource FSLUG mailing list
> Christiansource at ofb.biz
> http://cs.uninetsolutions.com

-- 
Why do the Democrats complain about Nader losing them Presidential elections?
Republicans don't complain about Libertarians.



More information about the Christiansource mailing list
Home About Connect: Twitter Facebook RSS
© 2001-2011 Universal Networks, All Rights Reserved. Some content rights may be held by Universal Networks' providers and used under license. Powered by ServerForest and SAFARI. Learn about our privacy policy here.