Question about BaseStream.Position

  • Thread starter Thread starter Peyman Zehtab-Fard
  • Start date Start date
P

Peyman Zehtab-Fard

Hi,
I am using a StreamWriter object creaed with a FileStream. At some point I
need to keep the offset of a certain string in the output file, to put in a
cross reference at the end of the file. When I try to use the
BaseStream.Position property (long offset = BaseStream.Position;) I allways
get 0. What should I use? Do I need to keep track of address myself? I need
equivalent of STL tellp().

thanks
Peyman Zehtab-Fard
 
Hi Peyman Zehtab-Fard,

Peyman Zehtab-Fard said:
Hi,
I am using a StreamWriter object creaed with a FileStream. At some point I
need to keep the offset of a certain string in the output file, to put in a
cross reference at the end of the file. When I try to use the
BaseStream.Position property (long offset = BaseStream.Position;) I allways
get 0. What should I use? Do I need to keep track of address myself? I need
equivalent of STL tellp().

If you haven't already tried this, call StreamWriter.Flush before you
retrieve the BaseStream.Position property.

Regards,
Dan
 
Back
Top