question about time_facet and date/time formatting
Hello Following the documentation, the time_facet::put function take 3 common parameters : "an iterator pointing to the next item in the stream, an ios_base object, and the fill character.".But this is not clear for me, i m totally new to facets. I m using it like that and it works well : stringstream log_stream ; ptime time = second_clock::local_time() ; time_facet facet("%Y-%m-%d %H:%M:%S") ; facet.put(log_stream, log_stream, ' ' , time) ; cout << log_stream.str() ; But I don't understand WHY it works and I wonder some things : What does mean the "iterator to the next item" from the documentation since I consider the target as an input stream ? Why use the same object for the "ios_base object" parameter ? This means I could use a different stream, but what could be the utility of such an usage of put() ? Finally, what is the use of the "fill character" ? Thanks in advance.
participants (1)
-
Axel