1
0
mirror of https://github.com/golang/go synced 2024-11-22 18:44:54 -07:00
go/misc/cgo/stdio/hello.go
Russ Cox 0432f289f7 cgo: various bug fixes
* remember #defined names, so that C.stdout can refer
  to the real name (on OS X) __stdoutp.
* better handling of #defined constant expressions
* allow n, err = C.strtol("asdf", 0, 123) to get errno as os.Error
* write all output files to current directory
* don't require gcc output if there was no input

Fixes #533.
Fixes #709.
Fixes #756.

R=r
CC=dho, golang-dev, iant
https://golang.org/cl/1734047
2010-07-14 17:17:53 -07:00

30 lines
520 B
Go

// 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()
}