ostream& __STL_CALL operator<<(ostream& __os, const basic_string<_CharT,_Traits,_Alloc>& __s) { __STL_USING_VENDOR_STD streambuf* __buf = __os.rdbuf(); if (__buf) { size_t __n = __s.size(); size_t __pad_len = 0; const bool __left = (__os.flags() & ios::left) !=0; const size_t __w = __os.width(); if (__w > 0) { __n = min(__w, __n); __pad_len = __w - __n; } if (!__left) __sgi_string_fill(__os, __buf, __pad_len); const size_t __nwritten = __buf->sputn(__s.data(), __n); if (__left) __sgi_string_fill(__os, __buf, __pad_len); if (__nwritten != __n) __os.clear(__os.rdstate() | ios::failbit); __os.width(0); } else __os.clear(__os.rdstate() | ios::badbit); return __os; }
MVS_API void reset(ostream& os) noexcept { os.clear(); os.fill(os.widen(' ')); os.flags(ios_base::skipws | ios_base::dec); os.precision(6); os.width(0); };
void printHeading( ostream& outs, string title, int width ) { //Declare Variables int magic_width = 0; magic_width = (width/2) - (title.length()/2) + title.length(); outs << "\n"; printHorizontalLine( outs, '*', width); outs << right << setfill(' ') << setw( magic_width ) << title << "\n"; printHorizontalLine( outs, '*', width); //reset cout outs.clear(); outs.fill(' '); }
void RandomSampleJob::ReportResults (ostream& r) { bool errorOccured = false; do { errorOccured = false; r << jobId << "\t" << KernalTypeToStr (config->KernalType ()) << "\t" << EncodingMethodToStr (config->EncodingMethod ()) << "\t" << CompressionMethodStr (compMethod) << "\t" << config->C_Param () << "\t" << config->Gamma () << "\t" << orderingNum << "\t" << numExamplesToKeep << "\t" << Accuracy () << "%" << "\t" << SupportVectors () << "\t" << trainTime << "\t" << testTime << endl; r.flush (); if (r.fail ()) { r.clear (); errorOccured = true; #ifdef WIN32 Sleep (30000); #else sleep (30); #endif } } while (errorOccured); } /* ReportResults */
// Threadsafe print a given stream. void print_stream(ostream &strng) { cout << strng.rdbuf(); cout.flush(); strng.clear(); }