# mmCloseFile

Closes an opened multimedia file and frees intermediate internal resources. If the file was opened in write mode, then mmCloseFile also writes data, as described in the Details section.

#### Prototype

DWORD mmCloseFile ( MMFILE *pMMFile)

Argument | Description
pMMFile | A pointer to the object that controls the multimedia file.

#### Return values

Return value | Description
SUCCESS |
MMERR_FILE_WRITE_FAILURE | File write failure; discard the file.
MMERR_INTERNAL_RESOURCE | Error on internal resource.
MMERR_INVALID_FILE | pMMFile is invalid.

#### Details

If the file was opened in write mode, mmCloseFile writes the data in the control header. mmCloseFile also writes data to the media stream, if the file was opened with one of these format settings:

- FORMAT_FLAG_WR_NORMAL

- FORMAT_FLAG_TEMP_MEM

- FORMAT_FLAG_TEMP_FILE

If the file was opened with the FORMAT_FLAG_WR_DIRECT setting, then the data is written to the media stream when mmWriteStream is invoked. For more information about opening a file, see mmOpenStream.

#### Example

DWORD ret;
ret = mmCloseFile(&mmFile);
if( ret != SUCCESS )
{
printf("ERROR: cannot close 3gp file\n");
return -1;
}