2008-09-12 17:03:16 -06:00
|
|
|
// Copyright 2009 The Go Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
package main
|
|
|
|
|
2009-03-18 15:09:16 -06:00
|
|
|
import (
|
2009-06-25 21:13:56 -06:00
|
|
|
"./file";
|
2009-03-18 15:09:16 -06:00
|
|
|
"fmt";
|
2009-05-08 16:21:41 -06:00
|
|
|
"os";
|
2009-03-18 15:09:16 -06:00
|
|
|
)
|
2008-09-12 17:03:16 -06:00
|
|
|
|
|
|
|
func main() {
|
2009-03-03 09:39:12 -07:00
|
|
|
hello := []byte{'h', 'e', 'l', 'l', 'o', ',', ' ', 'w', 'o', 'r', 'l', 'd', '\n'};
|
2009-03-16 23:53:23 -06:00
|
|
|
file.Stdout.Write(hello);
|
|
|
|
file, err := file.Open("/does/not/exist", 0, 0);
|
2009-01-09 16:16:31 -07:00
|
|
|
if file == nil {
|
2009-03-18 15:09:16 -06:00
|
|
|
fmt.Printf("can't open file; err=%s\n", err.String());
|
2009-05-08 16:21:41 -06:00
|
|
|
os.Exit(1);
|
2008-09-12 17:03:16 -06:00
|
|
|
}
|
|
|
|
}
|