thank you ofc, but just as a small side-note: The code will be as slow as hell with big files (as you use asc read with just one byte..).

Just test your code (i havn't - but had a short look at your code), with any big (+1MB) file.

You have to read all bytes until the write position at once.