file.write writes the length of the array, which is what you see: Writes a string, together with its length. The format is implementation-specific and should only be used in conjunction with read. Throw WriteException on error. fix: file.writeString(patch); (BTW, notice that use of std.stream is not recommended)