![]() |
VOOZH | about |
In Go language, fmt package implements formatted I/O with functions analogous to C's printf() and scanf() function. The fmt.Fprintf() function in Go language formats according to a format specifier and writes to w. Moreover, this function is defined under the fmt package. Here, you need to import the "fmt" package in order to use these functions.
Syntax:
func Fprintf(w io.Writer, format string, a ...interface{}) (n int, err error)
Parameters: This function accepts three parameters which are illustrated below-
Return Value: It returns the number of bytes written and any write error encountered.
Example 1:
Output:
GeeksforGeeks is a CS portal. 30 bytes written. <nil>
Example 2:
Output:
5 + 10 = 15. 13 bytes written. <nil>