# AddFileBinaryItem

### int AddFileBinaryItem(int lMsgId, string strFile)

SECS 메시지를 작성할 때, 지정된 경로의 파일을 읽어 바이너리(Binary, B) 배열 형태로 메시지 아이템에 추가합니다. 주로 장비의 레시피 파일 전송이나 로그 데이터 전송 시에 사용됩니다.

Parameters

<table data-header-hidden><thead><tr><th width="215" valign="top"></th><th width="99" 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">strFile</td><td valign="top">string</td><td valign="top">메시지에 추가할 파일의 경로와 확장자를 포함한 파일명</td></tr></tbody></table>

```csharp
int msgId = m_gem.CreateMsg(6,11,1); // 새로운 메시지 ID 생성 예시
string recipePath = @"C:\Recipes\Product_A.rcp";

// 파일을 바이너리 아이템으로 메시지에 추가
int result = m_gem.AddFileBinaryItem(msgId, recipePath);

m_gem.SendMsg(msgId);

if (result == 0)
{
    Console.WriteLine("File successfully attached to SECS message.");
}
else
{
    // 파일이 없거나, 경로가 잘못되었거나, 권한이 없는 경우 등
    Console.WriteLine($"Failed to add file binary item. Error Code: {result}");
}
```


---

# 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/addfilebinaryitem.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.
