# GetMsgText

### int GetMsgText(int lMsgId, ref string\[] arrMsgText, ref int nLineCount)

지정한 메시지 ID(`lMsgId`)의 내용을 텍스트 형식으로 변환하여 문자열 배열(`arrMsgText`)에 담아줍니다. 각 배열의 요소는 메시지의 한 줄(Line)에 해당하며, 전체 줄 수도 함께 반환합니다.

{% hint style="info" %}
로그 시각화: GUI에서 통신 로그 창을 구현할 때 이 함수를 호출하여 리스트박스나 텍스트 영역에 바로 바인딩할 수 있습니다.
{% endhint %}

Parameters

<table data-header-hidden><thead><tr><th width="164"></th><th width="171"></th><th></th></tr></thead><tbody><tr><td><strong>Name</strong></td><td><strong>Type</strong></td><td><strong>Description</strong></td></tr><tr><td>lMsgId</td><td>int</td><td>텍스트로 변환할 대상 메시지의 ID</td></tr><tr><td>arrMsgText</td><td>ref string[]</td><td>(Output) 변환된 텍스트가 저장될 문자열 배열</td></tr><tr><td>nLineCount</td><td>ref int</td><td>(Output) 변환된 텍스트의 총 줄(Line) 수</td></tr></tbody></table>

```csharp
void DisplayMessageSML(int lMsgId)
{
    string[] smlLines = null;
    int lineCount = 0;

    int result = m_gem.GetMsgText(lMsgId, ref smlLines, ref lineCount);

    if (result >= 0 && smlLines != null)
    {
        Console.WriteLine($"--- Message ID: {lMsgId} (Total {lineCount} lines) ---");
        foreach (string line in smlLines)
        {
            Console.WriteLine(line);
        }
    }
}
```


---

# 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-parsing/getmsgtext.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.
