1
1
12rbah2020-03-24 10:02:06
go
12rbah, 2020-03-24 10:02:06

What does /dev/stdin mean in windows?

The code looks like this:

func main(){
...
filesWithMatch += countLines(os.Stdin, counts)
...
}

func countLines(f *os.File, counts map[string]int) string {
  input := bufio.NewScanner(f)
  for input.Scan() {
    counts[input.Text()]++
  }
  for _, n := range counts {
    if n > 1 {
      return f.Name()
    }
  }
  return ""
}

If you pass stdin as arguments and not a file, then /dev/stdin will be written to filesWithMatch. Is it correct to assume that the input stream is some kind of file or not?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
Karpion, 2020-03-24
@12rbah

Apparently the same as in Libux/FreeBSD: a file associated with "standard input". Tell more?

K
Korben5E, 2020-03-24
@Korben5E

stdin can be either a file or just a stream, the output of another program.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question