# SaveMsgToFile

### int SaveMsgToFile(int lMsgId, string sFilePath)

lMsgId에 해당하는 Message를 파일로 저장하는 함수.

Parameters

<table data-header-hidden><thead><tr><th width="179" valign="top"></th><th width="116" 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">Message ID</td></tr><tr><td valign="top">sFilePath</td><td valign="top">string</td><td valign="top">Message를 저장할 파일경로</td></tr></tbody></table>

```csharp
// 1. 저장할 파일 경로 설정
// 예: 현재 실행 경로에 메시지 덤프 파일 생성
string strFilePath = @"D:\Logs\MsgDump_S1F3.txt";

// 2. SaveMsgToFile 호출
// lMsgId: 저장하고자 하는 메시지의 고유 식별 ID
// sFilePath: 저장할 파일의 전체 경로
int nResult = m_gem.SaveMsgToFile(lMsgId, strFilePath);
```

{% hint style="info" %}
확장자가 BIG 일경우 MessageViewer로 열어서 확인이 가능합니다.

저장해둔 Msg를 다른 장비에 동일하게 전달해 줄 때 용이합니다.
{% endhint %}

D:\Logs 에 txt파일 생성

<figure><img src="/files/oZ6H4MRLkxmvLzayb6yw" alt=""><figcaption></figcaption></figure>


---

# 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/undefined-1/savemsgtofile.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.
