> For the complete documentation index, see [llms.txt](https://docs.hyperdbg.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.hyperdbg.org/commands/scripting-language/functions/exports/printf.md).

# printf

### Function

> printf

### Syntax

> printf( Format, Expressions \[...] );

### Parameters

**\[Format-string]**

A printf-like format string.

**\[Expression] \[...]**

[MASM-like expression(s)](https://docs.hyperdbg.org/commands/scripting-language/assumptions-and-evaluations) to evaluate, you can choose multiple expressions based on the format string.

### Description

Evaluates and prints a printf-like format string with MASM expression(s).

{% hint style="danger" %}
All the format specifiers should be in a lower-case format.
{% endhint %}

### Supported Format Specifiers

| Specifier | Description              |
| --------- | ------------------------ |
| **%d**    | Decimal signed integer   |
| **%i**    | Decimal signed integer   |
| **%u**    | Decimal unsigned integer |
| **%o**    | Octal integer            |
| **%x**    | Hex integer              |
| **%c**    | Character (char)         |
| **%p**    | Pointer (void \*)        |
| **%s**    | String                   |
| **%ws**   | Wide-String              |
| **%ls**   | Wide-String              |

### Integer Format Specifiers (Long)

| Specifier | Description                   |
| --------- | ----------------------------- |
| **%ld**   | Long decimal signed integer   |
| **%li**   | Long decimal signed integer   |
| **%lu**   | Long decimal unsigned integer |
| **%lo**   | Long octal integer            |
| **%lx**   | Long hex integer              |

### Integer Format Specifiers (Long Long)

| Specifier | Description                                 |
| --------- | ------------------------------------------- |
| **%lld**  | Long long (64-bit) decimal signed integer   |
| **%lli**  | Long long (64-bit) decimal signed integer   |
| **%llu**  | Long long (64-bit) decimal unsigned integer |
| **%llo**  | Long long (64-bit) octal integer            |
| **%llx**  | Long long (64-bit) hex integer              |

### Integer Format Specifiers (Short)

| Specifier | Description                    |
| --------- | ------------------------------ |
| **%hd**   | Short decimal signed integer   |
| **%hi**   | Short decimal signed integer   |
| **%hu**   | Short decimal unsigned integer |
| **%ho**   | Short octal integer            |
| **%hx**   | Short hex integer              |

### Examples

`printf("Result is %s", @rcx);`

Print data as an ASCII string pointed by **rcx** register.

`print("The value is %llx and the string is : %ws "dq(@rcx), poi(rax));`

Print and evaluate the above expressions. Note that **%ws** is a wide-string pointed by **rax** register. Also, the value of **rcx** register is also dereferenced and showed in quad-hex format.

{% hint style="success" %}
You can see more examples [here](https://docs.hyperdbg.org/commands/scripting-language/examples/view-system-state).
{% endhint %}

### Remarks

You should consider avoiding ["unsafe" behavior](https://docs.hyperdbg.org/tips-and-tricks/considerations/the-unsafe-behavior) in your expressions and strings.

### Related

[print](https://docs.hyperdbg.org/commands/scripting-language/functions/exports/print)


---

# 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, and the optional `goal` query parameter:

```
GET https://docs.hyperdbg.org/commands/scripting-language/functions/exports/printf.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
