Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

The GNU C Programming Tutorial - Formatted string output

Node:Formatted string output, Next:, Previous:Unformatted string output, Up:String output and input



Formatted string output

The functions in this section are for formatted output of strings to streams. They are generally quite safe to use.

Formatted output is textual output via functions such as printf or fprintf. These take as an argument a string containing special character sequences such as %d (which indicates that an integer argument will follow). After this string, other arguments that correspond to the special character sequences follow. When the functions combine these arguments, the result is formatted textual output.

The next several sections discuss four formatted output functions. The most basic, printf, prints to standard output. The fprintf function is a high-level routine that sends its output to a stream, sprintf "prints" to a string, and asprintf is a safer way of printing to a string.

 
 
  Published under free license. Design by Interspire