// These routines end in 'f' and take a format string.
// Fprintf formats according to a format specifier and writes to w.
+// It returns the number of bytes written and any write error encountered.
func Fprintf(w io.Writer, format string, a ...interface{}) (n int, error os.Error) {
p := newPrinter()
p.doPrintf(format, a)
}
// Printf formats according to a format specifier and writes to standard output.
+// It returns the number of bytes written and any write error encountered.
func Printf(format string, a ...interface{}) (n int, errno os.Error) {
n, errno = Fprintf(os.Stdout, format, a)
return n, errno
}
// Sprintf formats according to a format specifier and returns the resulting string.
+// It returns the number of bytes written.
func Sprintf(format string, a ...interface{}) string {
p := newPrinter()
p.doPrintf(format, a)
// Fprint formats using the default formats for its operands and writes to w.
// Spaces are added between operands when neither is a string.
+// It returns the number of bytes written and any write error encountered.
func Fprint(w io.Writer, a ...interface{}) (n int, error os.Error) {
p := newPrinter()
p.doPrint(a, false, false)
// Print formats using the default formats for its operands and writes to standard output.
// Spaces are added between operands when neither is a string.
+// It returns the number of bytes written and any write error encountered.
func Print(a ...interface{}) (n int, errno os.Error) {
n, errno = Fprint(os.Stdout, a)
return n, errno
// Sprint formats using the default formats for its operands and returns the resulting string.
// Spaces are added between operands when neither is a string.
+// It returns the number of bytes written.
func Sprint(a ...interface{}) string {
p := newPrinter()
p.doPrint(a, false, false)
// Fprintln formats using the default formats for its operands and writes to w.
// Spaces are always added between operands and a newline is appended.
+// It returns the number of bytes written and any write error encountered.
func Fprintln(w io.Writer, a ...interface{}) (n int, error os.Error) {
p := newPrinter()
p.doPrint(a, true, true)
// Println formats using the default formats for its operands and writes to standard output.
// Spaces are always added between operands and a newline is appended.
+// It returns the number of bytes written and any write error encountered.
func Println(a ...interface{}) (n int, errno os.Error) {
n, errno = Fprintln(os.Stdout, a)
return n, errno
// Sprintln formats using the default formats for its operands and returns the resulting string.
// Spaces are always added between operands and a newline is appended.
+// It returns the number of bytes written.
func Sprintln(a ...interface{}) string {
p := newPrinter()
p.doPrint(a, true, true)