'StrToByte'에 해당하는 글 1건

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace _CS__StrToByteArray
{
    public partial class Form1 : Form
    {
        public static byte[] VISION_OK = new byte[] { 0x4F, 0x4B, 0x0D, 0x0A };
        public static byte[] VISION_NG = new byte[] { 0x4E, 0x47, 0x0D, 0x0A };

        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string sStr = System.Text.Encoding.ASCII.GetString(VISION_NG);

            byte[] sByte = StrToByteArray("F220V" + "123456789012\r\n");
           
        }

        private byte[] StrToByteArray(string sStr)
        {
            System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
            return encoding.GetBytes(sStr);
        }

    }
}

'020. Prigraming > 01. C#' 카테고리의 다른 글

[C#] ASCII 변환 알아보자  (0) 2011.02.16
[C#] Ping Test  (0) 2010.10.17
[C#] List 제네릭 클래스  (0) 2010.09.08
[C#] 나에겐 여전히 부담되는... [Thread]  (0) 2010.09.08
[C#] 서버시간과의 동기화 처리  (1) 2010.07.24

WRITTEN BY
테네시왈츠
항상 겸손하게 항상 새롭게 항상 진실하게

,