Can I use the Boost format library to replace iostream?

I don't like using <iostream>in C ++ Library. I prefer to use something similar to "printf" and "scanf" in <stdio.h>.

Is it possible to use the Boost format library to replace <iostream>in my entire C ++ program?

+3
source share
5 answers

The formatting format contains only the formatting bit. You still need iostream for something to actually appear on the screen.

, , printf, . , ( , printf).

+5

Boost.Format ostream.

cout << boost::format("%2% %1%") % 36 % 77; 

string s2 = str( format("%2% %1%") % 36 % 77 );

, .

Boost.Format istreams.

+5

printf ++, . #include <cstdio>, . , iostream ( - ), - .

+2

printf scanf , .

++, , . ++ .

, boost:: format, . boost:: format, , , ( ).

0

The short answer asked by others, yes, but there is no equivalent for scanfin Boost format. However, an alternative is to use the Boost Spirit library , which has both input and output capabilities through the Karma and Qi components, respectively. This may well be too large for what you are doing, as this is a complete implementation of the parser / generator.

0
source

Source: https://habr.com/ru/post/1743628/


All Articles