Post

GoLangGoLang

A
Athiq mohd

Posted on 28th January 2023|18 views

0
votes

Golang Read From Stdin

How to read from stdin in Go?

Answers
P
sumana reddy

Posted on 28th January 2023

To read from standard input stream use os.Stdin like this example

scanner := bufio.NewScanner(os.Stdin)

for scanner.Scan() {

fmt.Println(scanner.Text())

}

 

if err := scanner.Err(); err != nil {

log.Println(err)

}

 

Write your answer

STILL GOT QUERIES?

Get a Live FREE Demo
  • Explore the trending and niche courses and learning maps
  • Learn about tuition fee, payment plans, and scholarships
  • Get access to webinars and self-paced learning videos