|
-
May 7th, 2010, 11:08 AM
#12
Re: Mixing istream and FILE*
 Originally Posted by Lindley
Cool, I'll definitely keep that link handy. I'm thinking at this point, though, it might be easier to just write operators for streams. After all, C structs are all public anyway, so it's not like there would be access problems....
Bah, it isn't that complicated, you should at least give it a try. If you open your file in either read or write (not both, don't know why), it should work fine.
Even if in the end your objects are only structs, you'll still end up writing a bunch stream operators, as opposed to a single syncfilestream class.
PS: Just in case you didn't notice, the code on that link's page 2 works. It doesn't require more than a copy paste.
Is your question related to IO?
Read this C++ FAQ article at parashift by Marshall Cline. In particular points 1-6.
It will explain how to correctly deal with IO, how to validate input, and why you shouldn't count on "while(!in.eof())". And it always makes for excellent reading.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|