码迷,mamicode.com
首页 > 其他好文 > 详细

64_设备文件的使用

时间:2019-10-06 00:07:49      阅读:67      评论:0      收藏:0      [点我收藏+]

标签:文件   关闭   can   int   you   string   std   write   读取   

package main

import (
"fmt"
"os"
)

func main() {
//os.Stdout.Close() //关闭设备文件,无法往屏幕上写文件
//往屏幕上写东西
os.Stdout.WriteString("are you ok!!\n")

//从设备中读取内容
os.Stdin.Close() //关闭后无法输入
var a int
fmt.Scan(&a)
fmt.Println("a=", a) //无法输入,默认值为:0

}

64_设备文件的使用

标签:文件   关闭   can   int   you   string   std   write   读取   

原文地址:https://www.cnblogs.com/zhaopp/p/11626114.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!