vxWorks에서 iostream 사용 관련.
iostreams Library
This library is configured into your VxWorks system with the INCLUDE_CPLUS_IOSTREAMS component.
For the GNU toolchain, the iostreams library header files reside in installDir/host/hostType/include/g++-3 directory. For the Diab toolchain, the iostreams library header files reside in the installDir/host/diab/include/cpp directory.
WARNING: Each compiler automatically includes the directories containing the header files for these libraries. You should never explicitly add those directories to your compiler include path. If you get warnings about missing headers, it probably means you are using the -nostdinc flag. This flag should never be used with this release of Tornado.
To use this library, include one or more of the header files after the vxWorks.h header in the appropriate modules of your application. The most frequently used header file is iostream.h, but others are available; see a C++ reference such as Stroustrup for information.
The standard iostreams objects (cin, cout, cerr, and clog) are global; that is, they are not private to any given task. They are correctly initialized regardless of the number of tasks or modules that reference them and they can safely be used across multiple tasks that have the same definitions of stdin, stdout, and stderr. However they cannot safely be used when different tasks have different standard I/O file descriptors; in such cases, the responsibility for mutual exclusion rests with the application.
The effect of private standard iostreams objects can be simulated by creating a new iostreams object of the same class as the standard iostreams object (for example, cin is an istream_withassign), and assigning to it a new filebuf object tied to the appropriate file descriptor. The new filebuf and iostreams objects are private to the calling task, ensuring that no other task can accidentally corrupt them.
ostream my_out (new filebuf (1)); /* 1 == STDOUT */
istream my_in (new filebuf (0), &my_out); /* 0 == STDIN;
* TIE to my_out */
For complete details on the iostreams library, see the GNU ToolKit User's Guide.
Thursday, November 24, 2005
Tuesday, November 22, 2005
Subscribe to:
Posts (Atom)
