Ne.app NeANT
The Ne.app NeANT User module of the NeANT distribution.
wostream.cpp
Go to the documentation of this file.
1
29#include <iostream> // for wcout, wostream, endl
30#include <sstream> // for wistringstream
31
32#include <examples.h>
33
34
35int main ()
36{
37 const double f = 3.1415926;
38
39 const wchar_t s[] = { 'K', 'e', 'n', 'a', 'v', 'o', ' ', '!', '\0' };
40
41 // create a read/write stringbuf object on wide char
42 // and attach it to an wistringstream object
43 std::wistringstream in (std::wios::in | std::wios::out);
44
45 // tie the wostream object to the wistringstream object
46 std::wostream out (in.rdbuf ());
47
48 out << L"test beginning !" << std::endl;
49 out.setf (std::wios::fixed, std::wios::floatfield);
50
51 // output f in fixed format
52 out << f << std::endl;
53
54 // store the current put-pointer position
55 std::wostream::pos_type pos = out.tellp ();
56
57 // output s
58 out << s << std::endl;
59
60 // output the all buffer to standard output
61 std::wcout << in.rdbuf () << std::endl;
62
63 // position the get-pointer
64 in.seekg (pos);
65
66 // output s
67 std::wcout << in.rdbuf () << std::endl;
68
69 return 0;
70}
#define f
Definition 17.names.cpp:119
#define s
#define pos
Definition 17.names.cpp:518
const int out
const int in
int main()
Definition wostream.cpp:35