# mco_backup_list
RT

> List the contents of a backup file.

### For an overview see page Incremental Online Backup in C

### Prototype

        void mco_backup_list(
            /*IN*/  mco_db_h con,
            /*IN*/  const char *file_name,
            /*OUT*/ mco_size_t *backup_list_size,
            /*OUT*/ mco_backup_info_t **backup_list,
            /*IN*/  char *err_buf,
            /*IN-OUT*/ unsigned int *err_buf_sz
        );

### Arguments

`con`
A database connection used to verify the database name stored in the backup file.
`file_name`
Name of the backup file to inspect.
`backup_list_size`
Pointer to a variable that will receive the number of backup records in the file.
`backup_list`
Pointer to a variable that will be set to an array of `mco_backup_info_t` descriptors. The memory is allocated internally and must be freed by the caller using `mco_sys_free()`.
`err_buf`
Buffer for error message (may be `NULL` if error details are not needed).
`err_buf_sz`
On input: size of `err_buf`. On output: number of characters written. If `NULL`, the function returns `MCO_E_ILLEGAL_PARAM`.

### Description

> This function reads the specified backup file and returns a list of all backup records it contains. Each record includes metadata such as `name`, `type`, `label`, timestamp, and size.

> The returned array must be explicitly deallocated using `mco_sys_free()` to avoid memory leaks.

> See Incremental Backup and Restore for more details.

### Return Codes

`MCO_S_OK`
Backup record list successfully retrieved.
`MCO_E_DISK_OPEN`
Failed to open the specified backup file.

### Example

        {
            mco_db_h con;
            MCO_RET rc;
            char * filename = “backup.bak”;
            char * label = “a label”;

            /* connect to a database */
            rc = mco_db_connect( db_name, &con );

            /* backup the database */
            rc = mco_backup_list( con, filename, ... );
        }

### Files

Header file:
mco.h
Source file:
mcobackup.c
Library:
libmcobackup.a