[Example 1]
/*
Select a file, TEST02.DAT, read and display 10 bytes of data
from the beginning of the file. Then move read pointer 50 bytes
ahead of current position, and read and display 50 bytes of data.
Used functions : aux_from_open , aux_from_close , aux_from_select
aux_from_read , aux_from_moveptr
*/
void sample1(){
int i, ret ;
unsigned char read_buf[SIZE] ;
int read_size, offset ;
if ( aux_from_open( "CEX 1.0M", "r" ) ) {
printf( "Failed opening file¥n" ) ;
}
else {
if ( aux_from_select( "TEST02.DAT" ) ) {
printf( "specified file not exist¥n" ) ;
}
else {
read_size = 10 ;
ret = aux_from_read( read_buf, read_size ) ;
if (ret != 0 ) {
for ( i=0 ; i<ret ; i++) {
printf( "%c", read_buf[i] ) ;
}
}
printf( "¥n---move pointer---¥n" );
offset = 50 ;
if ( aux_from_moveptr( offset, FROM_SEEK_CUR ) ) {
printf( "Failed moving pointer¥n" ) ;
}
else {
read_size = 50 ;
ret = aux_from_read( read_buf, read_size ) ;
if (ret != 0 ) {
for ( i=0 ; i<ret ; i++) {
printf( "%c", read_buf[i] ) ;
}
}
}
}
aux_from_close() ;
}
}