Handling stdin in Go: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
(Created page with "=Internal= * Go Code Examples =Overview=")
 
Line 1: Line 1:
=Internal=
=Internal=
* [[Go_Code_Examples#Code_Examples|Go Code Examples]]
* [[Go_Code_Examples#Code_Examples|Go Code Examples]]
=Overview=
=<tt>fmt.Scan()</tt>=
<syntaxhighlight lang='go'>
var s string
cnt, err := fmt.Scan(&s)
fmt.Printf("input line: %s, cnt: %d, error: %s\n", s, cnt, err)
</syntaxhighlight>

Revision as of 00:26, 23 August 2023

Internal

fmt.Scan()

var s string
cnt, err := fmt.Scan(&s)
fmt.Printf("input line: %s, cnt: %d, error: %s\n", s, cnt, err)