Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Golang Fprint* what does the f stand for

Tags:

go

The fmt package has some functions for string formatting. Sprint* I am pretty sure stands for string print. Print* writes to STDOUT What does the F stand for with the Fprint* functions?

like image 705
Lee Avatar asked Jan 18 '14 12:01

Lee


1 Answers

The "f" stands for "file" - it's a C/Unix-ism. Of course Fprint can write to arbitrary Writers, but in the Unix world file is a pretty generic concept and can refer to pretty much anything from "normal" files to socket (streams) or data generated by programs (before any downvotes - yes, I know I'm a bit oversimplifying things, but the question wasn't about the Unix concept of a file so...)

The fmt function names are similar to the C names to ease C programmers already familiar with them in.

like image 182
Cubic Avatar answered Nov 08 '22 19:11

Cubic