bytes_written
needs to be an address of a variable; the compiler wouldn't compile the statement you posted.
Likewise, "OVERLAP
" doesn't make sense.
Did you check whether CreateFile
succeeded?
What's in write_buf
when you call strlen
on it?
Try copy-and-pasting the actual code that you're using.
Also that doesn't seem like a very good/informative sample that you're using. Try http://www.robbayer.com/files/serial-win.pdf and http://msdn.microsoft.com/en-us/library/ms810467.aspx
Also start with the sample program from the Microsoft site, test it before you modify it (to check that it's working on your machine) and then modify it.