Computer Science Canada

[Tip] Getting used to printf formatters

Author:  wtd [ Sun Feb 05, 2006 7:02 pm ]
Post subject:  [Tip] Getting used to printf formatters

So, you're trying to get used to printing formatted code with printf. But that means lots of compiling and recompiling, right? And for the sake of running tiny snippets of code. What a pain.

There's an easier way. Install Ruby, and you can use its printf method via the interactive interpreter.

Author:  Onega [ Mon May 08, 2006 12:04 am ]
Post subject: 

For C++ programmer, it is recommended to use iostream instead of printf. There are a lot of exploits related to printf function.

Author:  [Gandalf] [ Mon May 08, 2006 12:49 am ]
Post subject: 

That should probably be "it is recommended to use iostream instead of stdio"?
What sort of exploits would you be talking about?

Author:  Onega [ Mon May 08, 2006 3:56 am ]
Post subject: 

"There are a lot of exploits related to printf function." I made a mistake that above statement is not true. "Buffer overrun" problem is realted to sprintf. But printf is still an unsafe method, because you may fail to match flags with actual parameters (i.e. type mismatch, less parameters provided)

Author:  wtd [ Mon May 08, 2006 9:57 am ]
Post subject: 

This forum covers languages other than C++, and C++'s "iostream" functionality is a lot less widespread than C-style print formatters.


: