# AddBinaryItem

#### short AddBinaryItem(int lMsgId, byte\[] pnValue)

메시지 작성시 Binary 데이터를 원하는 길이로 추가해주는 함수.

Parameters

<table data-header-hidden><thead><tr><th width="187" valign="top"></th><th width="91" valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top">Name</td><td valign="top">Type</td><td valign="top">Description</td></tr><tr><td valign="top">lMsgId</td><td valign="top">int</td><td valign="top">작성중인 메시지의 고유 ID</td></tr><tr><td valign="top">pnValue</td><td valign="top">byte[]</td><td valign="top">추가할 Binary데이터의 배열</td></tr></tbody></table>

<pre class="language-csharp"><code class="lang-csharp"><strong>// 1. 추가할 바이너리 데이터 준비 (byte 배열)
</strong>// 예: 장비 제어를 위한 4바이트 바이너리 데이터
    byte[] binData = new byte[] { 0x01, 0x02, 0x03, 0x04 };
    
// 2. AddBinaryItem 호출
// 내부적으로 배열의 Length를 계산하여 해당 길이만큼 추가합니다.
    int nResult = m_gem.AddBinaryItem(lMsgId, binData);

    // 3. 결과 확인
    if (nResult == 0)
    {
        Console.WriteLine("Binary 아이템 추가 성공");
    }
    else
    {
        // 실패 시 반환된 에러 코드를 확인합니다.
        Console.WriteLine($"Binary 아이템 추가 실패. 에러 코드: {nResult}");
    }
</code></pre>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://nviasoft.gitbook.io/nviasoft-docs/api-reference/item/addbinaryitem.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
