|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
From: Dee Holtsclaw (dee_at_SUNBELTSOFT.COM)
Date: Thu Feb 06 2003 - 17:47:36 CST
To put it simply: you can't. The output file stream you're using is not
capable of inserting in such manner nor was it ever intended to. You're
going to have to put your data from step 3 into a (different) temporary
stream, write your information from step 5, then copy the whole contents of
the temporary stream into the first one.
Ciao,
Dee
P.S. If you're still stuck, please email me directly so we don't clutter up
the DCOM list.
-----Original Message-----
From: Distributed COM-Based Code [mailto:DCOM
DISCUSS.MICROSOFT.COM]On
Behalf Of Sankar Ramanathan
Sent: Thursday, February 06, 2003 4:13 PM
To: DCOM
DISCUSS.MICROSOFT.COM
Subject: OT: Inserting data in a stream
Hi All
Sorry about the OT.
I am working on a stream related issue of late. I have
a std::ofstream which I use to stream data to a file.
This is what is done and needed
1. Insert contents to an ofstream
2. At a given position, call tellp to get the current
position of the buffer and save it in a member
variable. (Say the current position is 4000)
3. Insert more contents into the stream. (Say the
current position is 12000)
4. Using the value stored in the member variable call
seekp to get to the previous position (current
position is 4000)
5. Insert some data starting from this position.
What I see is that the stream gets overwritten with
the inserted contents (in step 5). What I need is to
INSERT the contents without overwriting/replacing the
existing data in the stream. With my limited knowledge
and the little help MSDN offers I am not able to get
too far.
It is not possible for me to preallocate some data in
the buffer (in step 2) because I am not sure about the
size of the data that needs to be written in step 5.
Would appreciate any help
Thanks
-Sankar
__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com
----------------------------------------------------------------
Users Guide http://discuss.microsoft.com/archives/mailfaq.asp
contains important info. Save time, search the archives at
http://discuss.microsoft.com/archives/index.html .
To unsubscribe, mailto:DCOM-signoff-request
DISCUSS.MICROSOFT.COM
----------------------------------------------------------------
Users Guide http://discuss.microsoft.com/archives/mailfaq.asp
contains important info. Save time, search the archives at
http://discuss.microsoft.com/archives/index.html .
To unsubscribe, mailto:DCOM-signoff-request
DISCUSS.MICROSOFT.COM
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]