Sunday, May 10, 2009

What is the difference between stream output and printf in C programming?

'printf' allows for formatting between characters, generally intended for output to the screen or output to a "file" to be printed later.





Stream output is intended for a data file for record retention or further processing like sorting. There are no options for control or format characters.

What is the difference between stream output and printf in C programming?
Stream Output, as you call it, is just a way to say that you want to put data (normally text) into a device. You put the data into a stream that flows to the device and then it does whatever it is designed to do with the data. This applies to anything that can recieve streams of bytes: printers, text or graphical screens, plotters, card punchers (I'm not sure if that's the proper name for that kind of device), etc.





printf is a standart C function who delivers those streams to a device called STDOUT, which is normally the screen of the computer (but can be changed). It has some good things (easy text formatting) and some not so good (memory usage might be a risky thing, as in most C programs, in some situations)
Reply:printf is a function used in language C


But stream output is cout function used in C++


No comments:

Post a Comment