> For the complete documentation index, see [llms.txt](https://nviasoft.gitbook.io/nviasoft-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://nviasoft.gitbook.io/nviasoft-docs/api-reference/item-parsing/getitem.md).

# GetItem

### int GetItem(int lMsgId, ref string pstrValue)

수신한 SECS 메시지의 현재 위치의 아이템값을 문자열로 읽음.

Parameters

<table data-header-hidden><thead><tr><th width="191" valign="top"></th><th width="121" 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">pstrValue</td><td valign="top">ref string</td><td valign="top">값을 저장할 변수</td></tr></tbody></table>

```csharp
    string strValue = ""; // 값을 저장할 변수

    // 1. GetItem 호출
    // 반환값(nLength)은 성공 시 읽어온 문자열의 길이를 반환합니다.
    int nLength = m_gem.GetItem(lMsgId, ref strValue);

    // 2. 결과 확인
    if (nLength >= 0)
    {
        Console.WriteLine($"아이템 읽기 성공: {strValue} (길이: {nLength})");
        
        // 비어있는 문자열 처리 예시
        if (nLength == 0)
        {
            Console.WriteLine("수신된 데이터가 빈 값입니다.");
        }
    }
    else
    {
        // nLength < 0 (실패 시)
        Console.WriteLine($"아이템 읽기 실패. 에러 코드: {nLength}");
    }
```


---

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