<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://nfex.ru/index.php?action=history&amp;feed=atom&amp;title=Csharp%2FC_Sharp_by_API%2FSystem.IO%2FFileStream</id>
		<title>Csharp/C Sharp by API/System.IO/FileStream - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://nfex.ru/index.php?action=history&amp;feed=atom&amp;title=Csharp%2FC_Sharp_by_API%2FSystem.IO%2FFileStream"/>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/C_Sharp_by_API/System.IO/FileStream&amp;action=history"/>
		<updated>2026-04-30T17:24:25Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://nfex.ru/index.php?title=Csharp/C_Sharp_by_API/System.IO/FileStream&amp;diff=4975&amp;oldid=prev</id>
		<title> в 15:31, 26 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/C_Sharp_by_API/System.IO/FileStream&amp;diff=4975&amp;oldid=prev"/>
				<updated>2010-05-26T15:31:35Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 15:31, 26 мая 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
			</entry>

	<entry>
		<id>http://nfex.ru/index.php?title=Csharp/C_Sharp_by_API/System.IO/FileStream&amp;diff=4976&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/C_Sharp_by_API/System.IO/FileStream&amp;diff=4976&amp;oldid=prev"/>
				<updated>2010-05-26T12:12:29Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==FileStream.Position==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;  &lt;br /&gt;
using System;&lt;br /&gt;
using System.IO;&lt;br /&gt;
public class BinaryFileTest {&lt;br /&gt;
    private static void Main() {&lt;br /&gt;
        FileStream fs = new FileStream(&amp;quot;test.dat&amp;quot;, FileMode.Create);&lt;br /&gt;
        BinaryWriter w = new BinaryWriter(fs);&lt;br /&gt;
        w.Write(1.2M);&lt;br /&gt;
        w.Write(&amp;quot;string&amp;quot;);&lt;br /&gt;
        w.Write(&amp;quot;string 2&amp;quot;);&lt;br /&gt;
        w.Write(&amp;quot;!&amp;quot;);&lt;br /&gt;
        w.Flush();&lt;br /&gt;
        w.Close();&lt;br /&gt;
        fs.Close();&lt;br /&gt;
        fs = new FileStream(&amp;quot;test.dat&amp;quot;, FileMode.Open);&lt;br /&gt;
        StreamReader sr = new StreamReader(fs);&lt;br /&gt;
        Console.WriteLine(sr.ReadToEnd());&lt;br /&gt;
        fs.Position = 0;&lt;br /&gt;
        BinaryReader br = new BinaryReader(fs);&lt;br /&gt;
        Console.WriteLine(br.ReadDecimal());&lt;br /&gt;
        Console.WriteLine(br.ReadString());&lt;br /&gt;
        Console.WriteLine(br.ReadString());&lt;br /&gt;
        Console.WriteLine(br.ReadChar());&lt;br /&gt;
        fs.Close();&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==FileStream.Read==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt; &lt;br /&gt;
using System;&lt;br /&gt;
using System.Windows.Forms;&lt;br /&gt;
using System.IO;&lt;br /&gt;
class MainClass&lt;br /&gt;
{&lt;br /&gt;
  public static void Main() &lt;br /&gt;
  {&lt;br /&gt;
    FileStream inStream = File.OpenRead(&amp;quot;C:\\test.txt&amp;quot;);&lt;br /&gt;
    FileStream outStream = File.OpenWrite(&amp;quot;C:\\test.txt&amp;quot; + &amp;quot;.bak&amp;quot;);&lt;br /&gt;
    byte[] buf = new byte[4096];&lt;br /&gt;
    int bytesRead;&lt;br /&gt;
    while ((bytesRead = inStream.Read(buf, 0, 4096)) &amp;gt; 0)&lt;br /&gt;
      outStream.Write(buf, 0, bytesRead);&lt;br /&gt;
    outStream.Flush();&lt;br /&gt;
    outStream.Close();&lt;br /&gt;
    inStream.Close();&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==FileStream.ReadByte==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt; &lt;br /&gt;
using System;&lt;br /&gt;
using System.IO;&lt;br /&gt;
class ShowFile {&lt;br /&gt;
  public static void Main(string[] args) {&lt;br /&gt;
    int i;&lt;br /&gt;
    FileStream fin;&lt;br /&gt;
    try {&lt;br /&gt;
      fin = new FileStream(&amp;quot;test.cs&amp;quot;, FileMode.Open);&lt;br /&gt;
    } catch(FileNotFoundException exc) {&lt;br /&gt;
      Console.WriteLine(exc.Message);&lt;br /&gt;
      return;&lt;br /&gt;
    } catch(IndexOutOfRangeException exc) {&lt;br /&gt;
      Console.WriteLine(exc.Message + &amp;quot;\nUsage: ShowFile File&amp;quot;);&lt;br /&gt;
      return;&lt;br /&gt;
    }&lt;br /&gt;
    // read bytes until EOF is encountered&lt;br /&gt;
    do {&lt;br /&gt;
      try {&lt;br /&gt;
        i = fin.ReadByte();&lt;br /&gt;
      } catch(Exception exc) {&lt;br /&gt;
        Console.WriteLine(exc.Message);&lt;br /&gt;
        return;&lt;br /&gt;
      }&lt;br /&gt;
      if(i != -1) Console.Write((char) i);&lt;br /&gt;
    } while(i != -1);&lt;br /&gt;
    fin.Close();&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==FileStream.SetLength==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;  &lt;br /&gt;
using System;&lt;br /&gt;
using System.IO;&lt;br /&gt;
    public class StrmWrtr&lt;br /&gt;
    {&lt;br /&gt;
        static public void Main (string [] args)&lt;br /&gt;
        {&lt;br /&gt;
            FileStream strm;&lt;br /&gt;
            StreamWriter writer;&lt;br /&gt;
            strm = new FileStream (&amp;quot;text.txt&amp;quot;, FileMode.OpenOrCreate, FileAccess.Write);&lt;br /&gt;
            writer = new StreamWriter (strm);&lt;br /&gt;
            strm.SetLength (0);&lt;br /&gt;
            while (true)&lt;br /&gt;
            {&lt;br /&gt;
                 string str = Console.ReadLine ();&lt;br /&gt;
                 if (str.Length == 0)&lt;br /&gt;
                     break;&lt;br /&gt;
                 writer.WriteLine (str);&lt;br /&gt;
            }&lt;br /&gt;
            writer.Close ();&lt;br /&gt;
            strm.Close ();&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
   &lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==FileStream.Write==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt; &lt;br /&gt;
using System;&lt;br /&gt;
using System.Windows.Forms;&lt;br /&gt;
using System.IO;&lt;br /&gt;
class MainClass&lt;br /&gt;
{&lt;br /&gt;
  public static void Main() &lt;br /&gt;
  {&lt;br /&gt;
    FileStream inStream = File.OpenRead(&amp;quot;C:\\test.txt&amp;quot;);&lt;br /&gt;
    FileStream outStream = File.OpenWrite(&amp;quot;C:\\test.txt&amp;quot; + &amp;quot;.bak&amp;quot;);&lt;br /&gt;
    byte[] buf = new byte[4096];&lt;br /&gt;
    int bytesRead;&lt;br /&gt;
    while ((bytesRead = inStream.Read(buf, 0, 4096)) &amp;gt; 0)&lt;br /&gt;
      outStream.Write(buf, 0, bytesRead);&lt;br /&gt;
    outStream.Flush();&lt;br /&gt;
    outStream.Close();&lt;br /&gt;
    inStream.Close();&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==FileStream.WriteByte==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt; &lt;br /&gt;
using System;&lt;br /&gt;
using System.IO;&lt;br /&gt;
class WriteToFile {&lt;br /&gt;
  public static void Main(string[] args) {&lt;br /&gt;
    FileStream fout;&lt;br /&gt;
    try {&lt;br /&gt;
      fout = new FileStream(&amp;quot;test.txt&amp;quot;, FileMode.Create);&lt;br /&gt;
    } catch(IOException exc) {&lt;br /&gt;
      Console.WriteLine(exc.Message + &amp;quot;\nError Opening Output File&amp;quot;);&lt;br /&gt;
      return;&lt;br /&gt;
    }&lt;br /&gt;
    // Write the alphabet to the file.&lt;br /&gt;
    try {&lt;br /&gt;
      for(char c = &amp;quot;A&amp;quot;; c &amp;lt;= &amp;quot;Z&amp;quot;; c++)&lt;br /&gt;
        fout.WriteByte((byte) c);&lt;br /&gt;
    } catch(IOException exc) {&lt;br /&gt;
      Console.WriteLine(exc.Message + &amp;quot;File Error&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    fout.Close();&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==new FileStream(&amp;quot;soaptest.xml&amp;quot;, FileMode.Create, FileAccess.ReadWrite)==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;  &lt;br /&gt;
using System;&lt;br /&gt;
using System.IO;&lt;br /&gt;
using System.Runtime.Serialization;&lt;br /&gt;
using System.Runtime.Serialization.Formatters.Soap;&lt;br /&gt;
class SoapTest&lt;br /&gt;
{&lt;br /&gt;
   public static void Main()&lt;br /&gt;
   {&lt;br /&gt;
      SerialEmployee emp1 = new SerialEmployee();&lt;br /&gt;
      SerialEmployee emp2 = new SerialEmployee();&lt;br /&gt;
      emp1.EmployeeID = 1;&lt;br /&gt;
      emp1.LastName = &amp;quot;B&amp;quot;;&lt;br /&gt;
      emp1.FirstName = &amp;quot;K&amp;quot;;&lt;br /&gt;
      emp1.YearsService = 12;&lt;br /&gt;
      emp1.Salary = 35000.50;&lt;br /&gt;
      emp2.EmployeeID = 2;&lt;br /&gt;
      emp2.LastName = &amp;quot;B&amp;quot;;&lt;br /&gt;
      emp2.FirstName = &amp;quot;J&amp;quot;;&lt;br /&gt;
      emp2.YearsService = 9;&lt;br /&gt;
      emp2.Salary = 23700.30;&lt;br /&gt;
      Stream str = new FileStream(&amp;quot;soaptest.xml&amp;quot;, FileMode.Create, FileAccess.ReadWrite);&lt;br /&gt;
      IFormatter formatter = new SoapFormatter();&lt;br /&gt;
      formatter.Serialize(str, emp1);&lt;br /&gt;
      formatter.Serialize(str, emp2);&lt;br /&gt;
      str.Close();&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
[Serializable]&lt;br /&gt;
public class SerialEmployee&lt;br /&gt;
{&lt;br /&gt;
   public int EmployeeID;&lt;br /&gt;
   public string LastName;&lt;br /&gt;
   public string FirstName;&lt;br /&gt;
   public int YearsService;&lt;br /&gt;
   public double Salary;&lt;br /&gt;
   public SerialEmployee()&lt;br /&gt;
   {&lt;br /&gt;
      EmployeeID = 0;&lt;br /&gt;
      LastName = null;&lt;br /&gt;
      FirstName = null;&lt;br /&gt;
      YearsService = 0;&lt;br /&gt;
      Salary = 0.0;&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==new FileStream(String fileName, FileMode.Open)==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;    &lt;br /&gt;
&lt;br /&gt;
using System;&lt;br /&gt;
using System.Collections.Generic;&lt;br /&gt;
using System.Collections.Specialized;&lt;br /&gt;
using System.IO;&lt;br /&gt;
using System.IO.rupression;&lt;br /&gt;
using System.Net;&lt;br /&gt;
using System.Net.Mail;&lt;br /&gt;
using System.Net.Sockets;&lt;br /&gt;
using System.Runtime.InteropServices;&lt;br /&gt;
using System.Text;&lt;br /&gt;
using System.Threading;&lt;br /&gt;
public class MainClass&lt;br /&gt;
{&lt;br /&gt;
    public static void Main()&lt;br /&gt;
    {&lt;br /&gt;
        using (Stream from = new FileStream(&amp;quot;c:\\test.txt&amp;quot;, FileMode.Open))&lt;br /&gt;
        using (Stream to = new FileStream(&amp;quot;c:\\test2.txt&amp;quot;, FileMode.OpenOrCreate))&lt;br /&gt;
        {&lt;br /&gt;
            int readCount;&lt;br /&gt;
            byte[] buffer = new byte[1024];&lt;br /&gt;
            while ((readCount = from.Read(buffer, 0, 1024)) != 0)&lt;br /&gt;
            {&lt;br /&gt;
                to.Write(buffer, 0, readCount);&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>