Intel 05-1832-002 IP Phone User Manual


 
Voice API for Windows Operating Systems Library Reference — November 2003 413
install user-defined I/O functions — dx_setuio( )
!
!!
! Example
#include <stdio.h>
#include <srllib.h>
#include <dxxxlib.h> /* voice library header file */
#include <windows.h>
int cd; /* channel descriptor */
DX_UIO myio; /* user definable I/O structure */
/*
* User defined I/O functions
*/
int my_read9(fd,ptr,cnt)
int fd;
char * ptr;
unsigned cnt;
{
printf("My read\n");
return(read(fd,ptr,cnt));
}
/*
* my write function
*/
int my_write(fd,ptr,cnt)
int fd;
char * ptr;
unsigned cnt;
{
printf("My write \n");
return(write(fd,ptr,cnt));
}
/*
* my seek function
*/
long my_seek(fd,offset,whence)
int fd;
long offset;
int whence;
{
printf("My seek\n");
return(lseek(fd,offset,whence));
}
void main(argc,argv)
int argc;
char *argv[];
{
.
. /* Other initialization */
.
DX_UIO uioblk;
/* Initialize the UIO structure */
uioblk.u_read=my_read;
uioblk.u_write=my_write;
uioblk.u_seek=my_seek;
/* Install my I/O routines */
dx_setuio(uioblk)
;
vodat_fd = dx_fileopen("JUNK.VOX",O_RDWR|O_BINARY);