ACE读取文件示例
ACE_TString strFileName( ACE_TEXT("D:\\诛仙.txt") );
ACE_FILE_IO fileHandler;
ACE_FILE_Addr addrFile( strFileName.c_str() );
ACE_FILE_Connector con;
if( con.connect( fileHandler, addrFile ) == -1 )
return -1;
ssize_t nReadLength(0);
do
{
char szRead[1024];
memset( szRead, 0, sizeof( szRead ) );
nReadLength = fileHandler.recv( szRead, sizeof( szRead )-1 );
if( nReadLength <= 0 )break;
szRead[ nReadLength ] = '\0';
AtlTrace( szRead );
} while( TRUE );
ACE_FILE_IO fileHandler;
ACE_FILE_Addr addrFile( strFileName.c_str() );
ACE_FILE_Connector con;
if( con.connect( fileHandler, addrFile ) == -1 )
return -1;
ssize_t nReadLength(0);
do
{
char szRead[1024];
memset( szRead, 0, sizeof( szRead ) );
nReadLength = fileHandler.recv( szRead, sizeof( szRead )-1 );
if( nReadLength <= 0 )break;
szRead[ nReadLength ] = '\0';
AtlTrace( szRead );
} while( TRUE );