?? test.c
字號:
#include "bitRingLib.h"
#include "stdLib.h"
#include "stdio.h"
static BIT_RNG_ID gTestBitRingId = NULL;
testInit( void )
{
if( gTestBitRingId == NULL )
{
gTestBitRingId = bitRingCreate( 1024 );
if( gTestBitRingId == NULL )
{
printf( "[ testInit ]:Create gTestBitRingId fail!" );
testDInit( );
return ( 0 );
}
}
return( 1 );
}
testDInit( void )
{
if( gTestBitRingId != NULL )
{
if( ( bitRingDelete( gTestBitRingId ) ) == ERROR )
{
printf( "[ testDInit ]: delete gTestBitRingId fails.\n" );
}
gTestBitRingId = NULL;
}
return( 1 );
}
put( int iPutNum )
{
int b;
unsigned char pucPutDataBuff[ 256 ];
int i;
for( i = 0; i < 128; i++ )
{
pucPutDataBuff[ i ] = i;
}
b= bitRingPut( gTestBitRingId, pucPutDataBuff, 256, iPutNum );
printf("put bit is %d\n",b );
printf( "The bitRing buff data :\n" );
for( i=0; i<128; i++ )
{
printf( "0x%2x ",gTestBitRingId->pcBuffStart[ i ] );
if( (i + 1) %10 == 0 )
printf( "\n" );
}
return( 1 );
}
get( int iGetNum )
{
unsigned char putGetDataBuff[ 256 ]={};
int i,c;
c= bitRingGet( gTestBitRingId, putGetDataBuff, 256, iGetNum );
printf("get bit is %d\n",c );
printf( "The get data is :\n" );
for( i=0; i<128; i++ )
{
printf( "0x%2x ",putGetDataBuff[ i ] );
if( (i + 1) %10 == 0 )
printf( "\n" );
}
return( 1 );
}
clear( void)
{
memset( gTestBitRingId->pcBuffStart, 0, 1024/8 );
bitRingFlush( gTestBitRingId );
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -