diff options
| author | Ondřej Surý <ondrej@sury.org> | 2011-09-13 13:11:55 +0200 | 
|---|---|---|
| committer | Ondřej Surý <ondrej@sury.org> | 2011-09-13 13:11:55 +0200 | 
| commit | 80f18fc933cf3f3e829c5455a1023d69f7b86e52 (patch) | |
| tree | 4b825dc642cb6eb9a060e54bf8d69288fbee4904 /misc/cgo/stdio/file.go | |
| parent | 28592ee1ea1f5cdffcf85472f9de0285d928cf12 (diff) | |
| download | golang-80f18fc933cf3f3e829c5455a1023d69f7b86e52.tar.gz | |
Imported Upstream version 60
Diffstat (limited to 'misc/cgo/stdio/file.go')
| -rw-r--r-- | misc/cgo/stdio/file.go | 44 | 
1 files changed, 0 insertions, 44 deletions
| diff --git a/misc/cgo/stdio/file.go b/misc/cgo/stdio/file.go deleted file mode 100644 index 021cbf909..000000000 --- a/misc/cgo/stdio/file.go +++ /dev/null @@ -1,44 +0,0 @@ -// 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. - -/* -A trivial example of wrapping a C library in Go. -For a more complex example and explanation, -see ../gmp/gmp.go. -*/ - -package stdio - -/* -#include <stdio.h> -#include <stdlib.h> -#include <sys/stat.h> -#include <errno.h> - -char* greeting = "hello, world"; -*/ -import "C" -import "unsafe" - -type File C.FILE - -var Stdout = (*File)(C.stdout) -var Stderr = (*File)(C.stderr) - -// Test reference to library symbol. -// Stdout and stderr are too special to be a reliable test. -var myerr = C.sys_errlist - -func (f *File) WriteString(s string) { -	p := C.CString(s) -	C.fputs(p, (*C.FILE)(f)) -	C.free(unsafe.Pointer(p)) -	f.Flush() -} - -func (f *File) Flush() { -	C.fflush((*C.FILE)(f)) -} - -var Greeting = C.GoString(C.greeting) | 
