|
C++网络编程 , page75 中的这个示例:
#include "ace/ACE.h"
#include "ace/OS.h"
#include "ace/Message_Block.h"
int main(int argc, char* argv[])
{
ACE_Message_Block* head = new ACE_Message_Block(BUFSIZ);
ACE_Message_Block* mblk = head;
for(;;)
{
ssize_t nbytes = ACE::read_n( ACE_STDIN, mblk->wr_ptr(), mblk->size() );
if( nbytes <= 0 )
break; //break out at EOF or error.
//Allocate message block and chain it at the end of list.
mblk->cont( new ACE_Message_Block(BUFSIZ) );
mblk = mblk->cont();
}
for( mblk = head; mblk != 0; mblk = mblk->cont() )
ACE::write_n( ACE_STDOUT, mblk->rd_ptr(), mblk->length() );
head->release(); //This releases all the memory in the chain.
return 0;
}
这个程序怎么用啊.//break out at EOF or error.
程序怎么输入才能自己结束啊 . 别告诉我是 ctrl+Z,这个我知道. 但如果是这样的话怎么看结果呢. |
|