make OS specific code handle streams other than stdout
added missing semicolon in windows specific code