1 Replies - 4880 Views - Last Post: 28 July 2010 - 08:28 AM Rate Topic: -----

#1 abhij1987   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 32
  • Joined: 04-May 09

How to get File Offset

Posted 27 July 2010 - 10:57 PM

Hi Guys,
Can anybody tell me how to get file offset.
In FileStream object when u call write method it wants file offset
fs.Write(System.Text.ASCIIEncoding.ASCII.GetBytes(Yourdata), 0, System.Text.ASCIIEncoding.ASCII.GetByteCount(Yourdata))


Instead of 0 i want existing file offset
please tell me how i can get it

Thanks
Is This A Good Question/Topic? 0
  • +

Replies To: How to get File Offset

#2 Curtis Rutland   User is offline

  • (╯□)╯︵ (~ .o.)~
  • member icon


Reputation: 5104
  • View blog
  • Posts: 9,283
  • Joined: 08-June 10

Re: How to get File Offset

Posted 28 July 2010 - 08:28 AM

Actually, it's not the file offset, it's the offset for the array.
Screenshot of IntelliSense: (C#, but you get it)
Posted Image

Anyway, if you want to append text to a file, use FileMode.Append when creating your FileStream object. Using Append, if the file does not exist, it will be created, otherwise, it will be opened and the stream will Seek to the end.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1