首页 > 其他 > 详细

go helloworld

时间:2019-02-09 15:27:05      阅读:154      评论:0      收藏:0      [点我收藏+]

 

// Sample program to show how a bytes.Buffer can also be used
// with the io.Copy function.
package main

import (
    "bytes"
    "fmt"
    "io"
    "os"
)

// main is the entry point for the application.
func main() {
    var b bytes.Buffer

    // Write a string to the buffer.
    b.Write([]byte("Hello"))

    // Use Fprintf to concatenate a string to the Buffer.
    fmt.Fprintf(&b, " World!\n")

    // Write the content of the Buffer to stdout.
    io.Copy(os.Stdout, &b)
}

输出

Hello World!

 

go helloworld

原文:https://www.cnblogs.com/sea-stream/p/10357521.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!