-
May 6th, 2010, 05:37 PM
#1
Mixing istream and FILE*
I'm working with some of my own code which defines operator>>, and some C objects which support read() functions taking a FILE*. I would like to store both types of object in the same file, one after the other.
At first I thought someone might have cleverly devised an istream-derived class which simply wraps a FILE*. Maybe it would be slower than an ifstream, but it would do what I need. However, after a bit of searching I've found no such thing, surprisingly.
So my next thought was, I'll just open an ifstream, read the first object, tellg(), close it, open the FILE*, and fseek() to the same location.
However, I'm not certain whether tellg() is guaranteed to return a result in bytes which would translate directly to the value needed by fseek(). Does anyone know what the story is there?
Also, any better ideas for how I could manage this?
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
|