The blog is very interesting. However, I can't see how to re-implement this in Go with only the syscall package or the golang.org/x/sys/windows package. It needs the functionality of C++ freopen(), which as far as I can tell is not possible with the WinAPI - From what I can gather, ReOpen() only works with file handles and not console handles returned by GetStdHandle().
On Monday, May 2, 2022 at 2:34:03 PM UTC+1: > > https://www.tillett.info/2013/05/13/how-to-create-a-windows-program-that-works-as-both-as-a-gui-and-console-application/ > > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/27aad81a-9eb9-47e9-8fcb-f494bfd10038n%40googlegroups.com.