---
name: "mcd_dump_data_register_text"
section: "3"
platform: "linux"
package: "libminicoredumper-dev"
version: "2.0.7-4"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/mcd_dump_data_register_text"
---

# mcd\_dump\_data\_register\_text(3)

register text data to be dumped

## NAME

mcd\_dump\_data\_register\_text, mcd\_vdump\_data\_register\_text - register text data to be dumped

## SYNOPSIS

```
#include <minicoredumper.h>
int mcd_dump_data_register_text(const char *ident,
                                unsigned long dump_scope,
                                mcd_dump_data_t *save_ptr,
                                const char *fmt, ...);
int mcd_vdump_data_register_text(const char *ident,
                                 unsigned long dump_scope,
                                 mcd_dump_data_t *save_ptr,
                                 const char *fmt,
                                 va_list ap);
```

Compile and link with *-lminicoredumper*.

## DESCRIPTION

The **mcd\_dump\_data\_register\_text**() function registers text data to be dumped. *ident* is a string to identify the text dump later. It must be non-NULL. If the *ident* is not unique, the text dump is appended to previously registered text dumps with the same *ident*. The data will only be dumped if a scope value greater than or equal to *dump\_scope* is requested by the [**minicoredumper**(1)](/minicoredumper/1.md). If *save\_ptr* is non-NULL, a pointer to the registered dump will be stored there. This is needed if [**mcd\_dump\_data\_unregister**(3)](/mcd_dump_data_unregister/3.md) will be used. *fmt* is a [**printf**(3)](/printf/3.md) format string used to print the text data to a dump file. The remaining arguments are pointer arguments specified by *fmt*. Each pointer argument must be of a type that is appropriate for the associated length modifier and conversion specifier in *fmt*. Since the arguments are always pointers, the syntax for these arguments matches that of [**scanf**(3)](/scanf/3.md).

The **mcd\_vdump\_data\_register\_text**() function is equivalent to the function **mcd\_dump\_data\_register\_text**() except that it is called with a *va\_list* instead of a variable number of arguments. These functions do not call the *va\_end* macro. Because they invoke the *va\_arg* macro, the value of *ap* is undefined after the call. See [**stdarg**(3)](/stdarg/3.md).

## RETURN VALUE

**mcd\_dump\_data\_register\_text**() and **mcd\_vdump\_data\_register\_text**() return 0 on success, otherwise an error value is returned.

## ERRORS

- **ENOMEM**

  Insufficient memory available to allocate internal structures.

- **EINVAL**

  *ident* was invalid or *fmt* was NULL.

- **EEXIST**

  A binary dump matching *ident* was already registered.

## EXAMPLE

Register a text dump with 2 different sized variables.

```
mcd_dump_data_t dd;
unsigned long val1;
unsigned char val2;
mcd_dump_data_register_text("tdump.txt", 6, &dd,
                            "val1=0x%lx val2=0x%hhx\n",
                            &val1, &val2);
```

## BUGS

When dumping, each pointer argument is typecasted based on the length modifier and conversion specifier associated with that argument. If this does not match the true type of the variable, the dumped text may be invalid.

The string specified in *ident* is also the file name of the text dump file. For this reason characters such as '/' are not permitted.

## SEE ALSO

[**libminicoredumper**(7)](/libminicoredumper/7.md), [**mcd\_dump\_data\_unregister**(3)](/mcd_dump_data_unregister/3.md)

The DiaMon Workgroup: \<http://www.diamon.org\>
