Is a stream seekable : FileStream : File Directory Stream C# Examples


C# Examples » File Directory Stream » FileStream »

 

Is a stream seekable









    
using  System;
using  System.IO;
public  class  MainClass  {
        public  static  void  Main()  {
                byte[]  buf2  =  new  byte[]  {  97,  112,  112,  108,  101,  115,  97,  117,  99,  101  };
                FileStream  s  =  new  FileStream("Foo.txt",  FileMode.Open);
                Console.WriteLine("Length:  {0},  Position:  {1}",  s.Length,  s.Position);
                if  (s.CanSeek)  {
                        s.Seek(13,  SeekOrigin.Begin);
                        Console.WriteLine(
                                "Position:  {0}",  s.Position);
                        s.Write(buf2,  0,  buf2.Length);
                }
        }
}
    
   
  
   




HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo File Directory Stream
» FileStream