summaryrefslogtreecommitdiff
path: root/misc/cgo/stdio/hello.go
blob: 9cb6e6884ce1ee5cfdd4640f2ed715d18288c639 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// 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

import (
	"os"
	"stdio"
)

func main() {
	stdio.Stdout.WriteString(stdio.Greeting + "\n")

	l := stdio.Atol("123")
	if l != 123 {
		println("Atol 123: ", l)
		panic("bad atol")
	}

	n, err := stdio.Strtol("asdf", 123)
	if n != 0 || err != os.EINVAL {
		println("Strtol: ", n, err)
		panic("bad atoi2")
	}

	stdio.TestAlign()
	stdio.TestEnum()
}