Use "SysLibFile.lib" to open/write/close files.
For access to mmc in CoDeSys begin every path with '\disk_mmc\' e.g. '\disk_mmc\myfile.bin'.
Writing files to mmc can take several 100ms depending on the size to write. If this will block the PLC cycle you can
use alternatively SysLibFileAsync.lib