프로그래밍/C#

C# 바이트 파일 저장

초징 2017. 5. 26. 10:30
반응형

바이트를 파일로 저장하기


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
private void Btn_byteSave_Click(object sender, EventArgs e)
{
    SaveFileDialog saveFileDialog1 = new SaveFileDialog();
    saveFileDialog1.Filter = "텍스트 문서|*.txt";
    saveFileDialog1.Title = "저장하기";
    DialogResult dr = saveFileDialog1.ShowDialog();
 
    if (dr == DialogResult.OK)
    {
        if (saveFileDialog1.FileName != "")
{
            string dir = saveFileDialog1.FileName; //경로 + 파일명
            FileStream file = new FileStream(dir, FileMode.Create);
            file.Write(testBuf1, 0, testBuf1.Length);
            file.Close();
        }
    }
}


cs


반응형