The OpenNET Project / Index page

[ новости /+++ | форум | теги | ]

Интерактивная система просмотра системных руководств (man-ов)

 ТемаНаборКатегория 
 
 [Cписок руководств | Печать]

wcout (3)
  • >> wcout (3) ( Solaris man: Библиотечные вызовы )
  • 
                           Standard C++ Library
                 Copyright 1998, Rogue Wave Software, Inc.
    
    
    NAME
         wcout
    
          - Controls output to a stream buffer  associated  with  the
         object stdout declared in <cstdio>.
    
    
    
    SYNOPSIS
         #include <iostream>
         extern wostream wcout;
         wostream wcout;
    
    
    
    DESCRIPTION
         The object wcout controls output to a stream buffer  associ-
         ated with the object stdout declared in <cstdio>. By default
         the standard C and C++ streams are synchronized, but perfor-
         mance  can be improved by using the ios_base member function
         synch_with_stdio to desynchronize them.
    
         After the object wcin  is  initialized,  wcin.tie()  returns
         &wcout,  which implies that wcin and wcout are synchronized.
         wcout uses the locale codecvt  facet  to  convert  the  wide
         characters  it receives to the tiny characters it outputs to
         stdout.
    
    
    
    FORMATTING
         The formatting is done through member functions or manipula-
         tors.
    
         MANIPULATORS  MEMBER FUNCTIONS
    
    
         showpos       setf(ios_base::showpos)
    
    
    
         noshowpos       unsetf(ios_base::showpos)
    
    
    
         showbase       setf(ios_base::showbase)
    
    
    
         noshowbase       unsetf(ios_base::showbase)
    
    
    
         uppercase       setf(ios_base::uppercase)
    
    
    
         nouppercase       unsetf(ios_base::uppercase)
    
    
    
         showpoint       setf(ios_base::showpoint)
    
    
    
         noshowpoint       unsetf(ios_base::showpoint)
    
    
    
         boolalpha       setf(ios_base::boolalpha)
    
    
    
         noboolalpha       unsetf(ios_base::boolalpha)
    
    
    
         unitbuf       setf(ios_base::unitbuf)
    
    
    
         nounitbuf       unsetf(ios_base::unitbuf)
    
    
    
         internal       setf(ios_base::internal,
                          ios_base::adjustfield)
    
    
    
         left       setf(ios_base::left,
                      ios_base::adjustfield)
    
    
    
         right       setf(ios_base::right,
                       ios_base::adjustfield)
    
         dec       setf(ios_base::dec,
                     ios_base::basefield)
    
    
    
         hex       setf(ios_base::hex,
                     ios_base::basefield)
    
    
    
         oct       setf(ios_base::oct,
                     ios_base::basefield)
    
    
    
         fixed       setf(ios_base::fixed,
                       ios_base::floatfield)
    
    
    
         scientific       setf(ios_base::scientific,
                            ios_base::floatfield)
    
    
    
         resetiosflags
           (ios_base::fmtflags flag)       setf(0,flag)
    
    
    
         setiosflags
           (ios_base::fmtflags flag)       setf(flag)
    
    
    
         setbase(int base)       see above
    
    
    
         setfill(char_type c)       fill(c)
    
    
    
         setprecision(int n)       precision(n)
    
    
    
         setw(int n)       width(n)
    
    
         endl
    
         ends
    
         flush       flush( )
    
    
    
    DESCRIPTION
         showpos   Generates  a  +  sign  in  non-negative  generated
                   numeric output.
    
    
    
         showbase   Generates a prefix indicating the numeric base of
                    generated integer output
    
    
    
         uppercase   Replaces certain lowercase  letters  with  their
                     uppercase equivalents in generated output
    
    
    
         showpoint   Generates a decimal-point character uncondition-
                     ally in generated floating-point output
    
    
    
         boolalpha   Inserts and extracts  bool  type  in  alphabetic
                     format
    
    
    
         unitbuf   Flushes output after each output operation
    
    
    
         internal   Adds fill characters  at  a  designated  internal
                    point  in  certain  generated  output. If no such
                    point is designated, it's identical to right.
    
    
    
         left   Adds fill characters on the right  (final  positions)
                of certain generated output
    
    
    
         right   Adds fill characters on the left (initial positions)
                 of certain generated output
    
    
    
         dec   Converts integer input or generates integer output  in
               decimal base
    
    
    
         hex   Converts integer input or generates integer output  in
               hexadecimal base
    
    
    
         oct   Converts integer input or generates integer output  in
               octal base
    
    
    
         fixed   Generates floating-point output in fixed-point nota-
                 tion
    
    
    
         scientific   Generates floating-point output  in  scientific
                      notation
    
    
         resetiosflags
    
         (ios_base::fmtflags flag)     Resets the fmtflags field flag
    
    
         setiosflags
    
         (ios_base::fmtflags flag)     Sets up the flag flag
    
    
    
         setbase(int base)    Converts  integer  input  or  generates
                             integer output in base base. The parame-
                             ter base can be 8, 10 or 16.
    
    
    
         setfill(char_type c)   Sets the character used to pad (fill)
                                an output conversion to the specified
                                field width
    
    
    
         setprecision(int n)   Sets the precision (number  of  digits
                               after  the  decimal point) to generate
                               on certain output conversions
    
    
         setw(int n)   Sets the field with (number of characters)  to
                       generate on certain output conversions
    
    
    
         showpos   Generates  a  +  sign  in  non-negative  generated
                   numeric output.
    
    
    
         showbase   Generates a prefix indicating the numeric base of
                    generated integer output
    
    
    
         uppercase   Replaces certain lowercase  letters  with  their
                     uppercase equivalents in generated output
    
    
    
         showpoint   Generates a decimal-point character uncondition-
                     ally in generated floating-point output
    
    
    
         boolalpha   Inserts and extracts  bool  type  in  alphabetic
                     format
    
    
    
         unitbuf   Flushes output after each output operation
    
    
    
         internal   Adds fill characters  at  a  designated  internal
                    point  in  certain  generated  output. If no such
                    point is designated, it's identical to right.
    
    
    
         left   Adds fill characters on the right  (final  positions)
                of certain generated output
    
    
    
         right   Adds fill characters on the left (initial positions)
                 of certain generated output
    
    
         dec   Converts integer input or generates integer output  in
               decimal base
    
    
    
         hex   Converts integer input or generates integer output  in
               hexadecimal base
    
    
    
         oct   Converts integer input or generates integer output  in
               octal base
    
    
    
         fixed   Generates floating-point output in fixed-point nota-
                 tion
    
    
    
         scientific   Generates floating-point output  in  scientific
                      notation
    
    
         resetiosflags
    
         (ios_base::fmtflags flag)     Resets the fmtflags field flag
    
    
         setiosflags
    
         (ios_base::fmtflags flag)     Sets up the flag flag
    
    
    
         setbase(int  base)   Converts  integer  input  or  generates
                              integer output in base base. The param-
                              eter base can be 8, 10 or 16.
    
    
    
         setfill(char_type c)   Sets the character used to pad (fill)
                                an output conversion to the specified
                                field width
    
    
    
         setprecision(int n)   Sets the precision (number  of  digits
                               after  the  decimal point) to generate
                               on certain output conversions
    
    
         setw(int n)   Sets the field with (number of characters)  to
                       generate on certain output conversions
    
    
    
         endl   Inserts a newline character into the output  sequence
                and flush the output buffer.
    
    
    
         ends   Inserts a null character into the output sequence.
    
    
    
         flush   Flush the output buffer.
    
    
    
    DEFAULT VALUES
         precision()            6
         width()                0
         fill()                 the space character
         flags()                skipws | dec
         getloc()               locale::locale()
    
    
    
    EXAMPLE
         //
         // wcout example #1
         //
         #include<iostream>
         #include<iomanip>
    
         void main ( )
         {
          using namespace std;
    
          int i;
          float f;
    
           // read an integer and a float from stdin
          cin >> i >> f;
    
           // output the integer and goes at the line
          wcout << i << endl;
    
           // output the float and goes at the line
          wcout << f << endl;
           // output i in hexa
          wcout << hex << i << endl;
    
           // output i in octal and then in decimal
          wcout << oct << i << dec << i << endl;
    
           // output i preceded by its sign
          wcout << showpos << i << endl;
    
           // output i in hexa
          wcout << setbase(16) << i << endl;
    
           // output i in dec and pad to the left with character
           // @ until a width of 20
           // if you input 45 it outputs 45@@@@@@@@@@@@@@@@@@
          wcout << setfill(L'@') << setw(20) << left << dec << i;
          wcout << endl;
    
           // output the same result as the code just above
           // but uses member functions rather than manipulators
          wcout.fill('@');
          wcout.width(20);
          wcout.setf(ios_base::left, ios_base::adjustfield);
          wcout.setf(ios_base::dec, ios_base::basefield);
          wcout << i << endl;
    
           // outputs f in scientific notation with
           // a precision of 10 digits
          wcout << scientific << setprecision(10) << f << endl;
    
           // change the precision to 6 digits
           // equivalents to wcout << setprecision(6);
          wcout.precision(6);
    
           // output f and goes back to fixed notation
          wcout << f << fixed << endl;
    
         }
    
         //
         // wcout example #2
         //
         #include <iostream>
    
         void main ( )
         {
          using namespace std;
    
          wchar_t p[50];
    
          wcin.getline(p,50);
    
          wcout << p;
         }
    
         //
         // wcout example #3
         //
         #include <iostream>
         #include <fstream>
    
         void main ( )
         {
          using namespace std;
    
           // open the file "file_name.txt"
           // for reading
          wifstream in("file_name.txt");
    
           // output the all file to stdout
          if ( in )
            wcout << in.rdbuf();
          else
             {
              wcout << "Error while opening the file";
              wcout << endl;
             }
         }
    
    
    
    WARNINGS
         Keep in mind that the manipulator endl  flushes  the  stream
         buffer. Therefore, use L`\n' if your only intent is to go at
         the line. It greatly improves performance  when  C  and  C++
         streams are not synchronized.
    
         If your compiler does not support namespaces,  then  you  do
         not need the using declaration for std.
    
    
    
    SEE ALSO
         basic_ostream(3C++),                   basic_iostream(3C++),
         basic_filebuf(3C++),   cin(3C++),   cout(3C++),  cerr(3C++),
         clog(3C++),    wcin(3C++),     wcerr(3C++),     wclog(3C++),
         iomanip(3C++), ios_base(3C++), basic_ios(3C++)
    
         Working Paper for Draft Proposed International Standard  for
         Information   Systems--Programming   Language  C++,  Section
         27.3.2
    
    STANDARDS CONFORMANCE
         ANSI X3J16/ISO WG21 Joint C++ Committee
    
    
    
    


    Поиск по тексту MAN-ов: 




    Партнёры:
    PostgresPro
    Inferno Solutions
    Hosting by Hoster.ru
    Хостинг:

    Закладки на сайте
    Проследить за страницей
    Created 1996-2024 by Maxim Chirkov
    Добавить, Поддержать, Вебмастеру