WriteFile & WriteFileIf + tests.