# Ini_CopySection

int Ini_CopySection (IniText source, const char sectionToCopy[], IniText destination, int overwriteDuplicateSections);

## Purpose

This function copies a section of tag-value pairs from one in-memory list to another.

If there already is a section of the same name in the Destination list, you have the option of overwriting the section or merging the two sections. If you merge the two sections, items with the same tags are overwritten unless you have disabled duplicate checking using the Ini_SetDuplicateChecking function.

## Parameters

Input
Name | Type | Description
source | IniText | A handle returned from Ini_New. It represents the list of in-memory tag/value pairs. This list will be copied into the list specified by the destination parameter.
sectionToCopy | const char [] | This parameter specifies the name of the section in the Source list to merge into the Destination List. Pass 0 to merge all of the sections in the Source list into the Destination list.
destination | IniText | A handle returned from Ini_New. It represents the list of in-memory tag/value pairs. The contents of the Source list will be copied into this list.
overwriteDuplicateSections | integer | This parameter specifies whether sections in the Source list completely overwrite previously existing sections with the same name in the Destination list. If there a section in the Destination list has the same name as a section being copied, you have the option of overwriting the section or merging the two sections. If you merge the two sections, items with the same tags are overwritten unless you have disabled duplicate checking using the Ini_SetDuplicateChecking function. Pass 1 (TRUE) to completely overwrite previously existing sections in the Destination. Pass 0 (FALSE) to merge the items in sections with same name into the Destination list. Items with the same tag names are overwritten unless you have disabled duplicate checking using the Ini_SetDuplicateChecking function.

## Return Value

Name | Type | Description
status | integer | Indicates whether the function was successful. A zero indicates success. A negative value indicates an error. If the value is from –1 to –999, it is one of the error values defined in userint.h. If the value is from –5000 to –5999, it is one of the error values defined in toolbox.h. The only error you are likely to encounter is:
–12 | Out of memory!