473,327 Members | 1,892 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

std::format


hi,

is it possible - or better: why hasn't it been in the std - to add
this function:

ofstream os("xy");
int my_int = 0;
double my_double =123.12;
os << std::format("8.3f", my_double) << std::format(".5d", my_int);

know what I mean? Because when you try to write a double in format
"%8.3f" to an ostream it's ridiculous what you have to write (using
ostringstream and such).

Where can I apply for that to be added?

--
-Gernot
int main(int argc, char** argv) {printf
("%silto%c%cf%cgl%ssic%ccom%c", "ma", 58, 'g', 64, "ba", 46, 10);}

________________________________________
Looking for a good game? Do it yourself!
GLBasic - you can do
www.GLBasic.com
Jul 14 '06 #1
1 6637
Gernot Frisch wrote:
hi,

is it possible - or better: why hasn't it been in the std - to add
this function:

ofstream os("xy");
int my_int = 0;
double my_double =123.12;
os << std::format("8.3f", my_double) << std::format(".5d", my_int);
Have a look at boost::format,
http://www.boost.org/libs/format/doc/format.html
Where can I apply for that to be added?
WG21 of course, see the comp.std.c++ FAQ for details. The logical place
to add it would be C++ Library Extensions TR2, which has an open call
for
proposals.

HTH,]
Michiel Salters

Jul 14 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

103
by: Steven T. Hatton | last post by:
§27.4.2.1.4 Type ios_base::openmode Says this about the std::ios::binary openmode flag: *binary*: perform input and output in binary mode (as opposed to text mode) And that is basically _all_ it...
15
by: Marcus Kwok | last post by:
How do you save the formatting options for a stream? In the program below, notice that when I define my operator<<() for the custom type, it permanently changes the output format of the stream: ...
3
by: Matt | last post by:
Does the standard define default values for the format state of an ostream? I would like to be able to put a stream in a standard format state without thinking about how some other routine may...
3
by: Gary Wessle | last post by:
Hi I wrote 2 functions "included at the bottom" one inserts and one reads data from a file, the data format is as here **************** a 2 b -0.0336974 _time 1.17312e+09 ****************
7
by: Grey Alien | last post by:
Does *ANYONE* in here know how I may parse the various date/time 'elements' from a string?. The input string has the ff format: 'YYYY-MM-DD HH:MM:SS AM'
5
by: Donovan Parks | last post by:
Hello, I am using VFW to extract image data from an AVI stream. Despite my best efforts, I can't seem to get the data to come out in RGB format. It always comes out in BGR format and mirrored...
3
by: Martin T. | last post by:
Hello. I tried to overload the operator<< for implicit printing of wchar_t string on a char stream. Normally using it on a ostream will succeed as std::operator<<<std::char_traits<char> will...
9
by: Fred Yu | last post by:
Hi, I want to encode input text into html format such as replace "<" with "&lt", replace "&" with "&amp". Could you give me some ideas? Thanks. Fred
4
by: Ramesh | last post by:
Hi, I need to convert unsigned long data to a std::string, I googled a bit to see if the string class supports any methods to achieve this - but didnt find any, I think of using sprintf and...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.