예제 #1
0
파일: iostrini.cpp 프로젝트: shuowen/OpenNT
/***
*Iostream_init::Iostream_init() - initialize predefined streams
*
*Purpose:
*	 Initializes predefined streams: cin, cout, cerr, clog;
*Entry:
*	pstrm = cin, cout, cerr, or clog
*	sflg =  1 if cerr (unit buffered)
*	sflg = -1 if cout
*
*Exit:
*
*Exceptions:
*
*******************************************************************************/
Iostream_init::Iostream_init(ios& pstrm, int sflg)
{
#if ((!defined(_WINDOWS)) || defined(_QWIN))
    pstrm.delbuf(1);
    if (sflg>=0)	// make sure not cout
        pstrm.tie(&cout);
    if (sflg>0)
        pstrm.setf(ios::unitbuf);
#endif
}
void
JSetState
	(
	ios&		stream,
	const int	flag
	)
{
#ifdef __SUNPRO_CC
	stream.clear(stream.rdstate() | flag);
#elif __GNUG__ >= 3
	stream.setstate((ios_base::iostate) flag);
#else
	stream.setstate(flag);
#endif
}
예제 #3
0
파일: main.cpp 프로젝트: CCJY/coliru
 void postSomething()
 {
     while(m_active)
     {
         m_io.post([]{std::cout<<"something...\n";});
         sleep(1000);
     }
 }
예제 #4
0
iostream::iostream( ios const &strm ) {
/*************************************/
// Public constructor, making an iostream with a streambuf attached.
// Associate the streambuf found in "strm" with the ios.
// Takes an ios so that it can be used with istream and ostream.

    streambuf *sb;

    __lock_it( strm.__i_lock );
    sb = strm.rdbuf();
    ios::init( sb );
}
예제 #5
0
파일: main.cpp 프로젝트: CCJY/coliru
 void update()
 {
     m_io.poll();
     //do other stuff
 }
예제 #6
0
파일: main.cpp 프로젝트: CCJY/coliru
 ~A() {
     m_active.reset();
     m_io.run(); // to completion
 }
예제 #7
0
static void beGood(const ios& i) {
    if(!i.good()) {
        printf("File I/O error.\n");
        exit(1);
    }
}
예제 #8
0
파일: util.cpp 프로젝트: AliSayed/MoSync
void beGood(ios& i) {
	if(!i.good()) {
		printf("File I/O error in '%s'\n", (char*)i.pword(IOS_NAME_INDEX));
		exit(1);
	}
}
예제 #9
0
파일: util.cpp 프로젝트: AliSayed/MoSync
void setName(ios& i, const char* name) {
	i.pword(IOS_NAME_INDEX) = (void*)name;
}