Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for Read (0.15 sec)

  1. src/bufio/example_test.go

    		b := w.AvailableBuffer()
    		b = strconv.AppendInt(b, i, 10)
    		b = append(b, ' ')
    		w.Write(b)
    	}
    	w.Flush()
    	// Output: 1 2 3 4
    }
    
    // The simplest use of a Scanner, to read standard input as a set of lines.
    func ExampleScanner_lines() {
    	scanner := bufio.NewScanner(os.Stdin)
    	for scanner.Scan() {
    		fmt.Println(scanner.Text()) // Println will add back the final '\n'
    	}
    Go
    - Registered: Tue Apr 23 11:13:09 GMT 2024
    - Last Modified: Mon Oct 23 09:06:30 GMT 2023
    - 4.9K bytes
    - Viewed (0)
  2. src/bytes/example_test.go

    	fmt.Printf("%s\n", b.Next(2))
    	fmt.Printf("%s\n", b.Next(2))
    	fmt.Printf("%s", b.Next(2))
    	// Output:
    	// ab
    	// cd
    	// e
    }
    
    func ExampleBuffer_Read() {
    	var b bytes.Buffer
    	b.Grow(64)
    	b.Write([]byte("abcde"))
    	rdbuf := make([]byte, 1)
    	n, err := b.Read(rdbuf)
    	if err != nil {
    		panic(err)
    	}
    	fmt.Println(n)
    	fmt.Println(b.String())
    	fmt.Println(string(rdbuf))
    	// Output:
    	// 1
    	// bcde
    Go
    - Registered: Tue Apr 23 11:13:09 GMT 2024
    - Last Modified: Mon Mar 04 15:54:40 GMT 2024
    - 15K bytes
    - Viewed (1)
Back to top