new FileStream(String fileName, FileMode.Open) : FileStream « System.IO « C# / C Sharp by API






new FileStream(String fileName, FileMode.Open)

    


using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.IO;
using System.IO.Compression;
using System.Net;
using System.Net.Mail;
using System.Net.Sockets;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;

public class MainClass
{
    public static void Main()
    {
        using (Stream from = new FileStream("c:\\test.txt", FileMode.Open))
        using (Stream to = new FileStream("c:\\test2.txt", FileMode.OpenOrCreate))
        {
            int readCount;
            byte[] buffer = new byte[1024];
            while ((readCount = from.Read(buffer, 0, 1024)) != 0)
            {
                to.Write(buffer, 0, readCount);
            }
        }
    }
}

   
    
    
    
  








Related examples in the same category

1.new FileStream("soaptest.xml", FileMode.Create, FileAccess.ReadWrite)
2.FileStream.Position
3.FileStream.Read
4.FileStream.ReadByte
5.FileStream.SetLength
6.FileStream.Write
7.FileStream.WriteByte