# format\_cdata

```
Format value(s) as a C/C++ data initializers
     outvec - reference to the output object
              after the call will contain array of strings
     value  - value to format
     type   - type of the data to format
     options- optional object, which may have the attributes PTV_...
                     'ptvf' - combination of PTV_... constants:
                     'flags'      number representation (e.g. hex_flag(), dec_flags(), etc)
                     'max_length' max length of the formatted text (0 means no limit)
                     'arrbase'    for arrays: the first element of array to print
                     'arrnelems'  for arrays: number of elements to print
                     'margin'     length of one line (0 means to print everything on one line)
                     'indent'     how many spaces to use to indent nested structures/arrays
     info   - object to store additional information about the generated lines
              after the call will contain array of objects, each of which has:
                     'ea' - address of the line
                     'type' - typeinfo of the line (may include label for the line as 'name')
              may be specified as 0 if this info is not required
Returns: error code

long format_cdata(object &outvec, anyvalue value, typeinfo type, object options, object &info);

#define PTV_DEREF  0x0001  // take value to print from the database.
                           // its address is specified by value.num (default)
#define PTV_QUEST  0x0002  // print '?' for uninited data
#define PTV_EMPTY  0x0004  // return empty string for uninited data (default)
#define PTV_CSTR   0x0008  // print constant strings inline (default)
#define PTV_EXPAND 0x0010  // print only top level on separate lines
                           // max_length applies to separate lines
                           // margin is ignored
#define PTV_LZHEX  0x0020  // print hex numbers with leading zeroes
#define PTV_STPFLT 0x0040  // fail on bad floating point numbers
                           // (if not set, just print ?flt for them)
#define PTV_SPACE  0x0080  // add spaces after commas and around braces (default)
#define PTV_DEBUG  0x0100  // format output for debugger
```


---

# Agent Instructions: 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://docs.hex-rays.com/9.0/developer-guide/idc/idc-api-reference/alphabetical-list-of-idc-functions/1646.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.
