Form1の全コード
using System;
using System.Windows.Forms;
using System.IO;
namespace FileTest3
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Button1_Click(object sender, EventArgs e)
{
if (OpenFileDialog1.ShowDialog() == DialogResult.OK)
{
using (BinaryReader reader = new BinaryReader(File.Open(OpenFileDialog1.FileName, FileMode.Open)))
{
int FLength =(int) reader.BaseStream.Length;
byte[] bytes = reader.ReadBytes(FLength);
if (SaveFileDialog1.ShowDialog() == DialogResult.OK)
{
using (BinaryWriter writer = new BinaryWriter(File.Open(SaveFileDialog1.FileName, FileMode.Create)))
{
writer.Write(bytes);
}
}
int i = 0;
}
}
}
}
}