CTI_Dx_fileopen

Màu nền
Font chữ
Font size
Chiều cao dòng

dx_fileopen( ) - opens a file

Mo mot file, tra ve gia tri -1 neu xay ra loi

int dx_fileopen(filep, flags, pmode) //(Ten file, Che do doc-ghi, che do cho phep)

/* Chay mot file am thanh, ket thuc khi nhan dc 4 so hoac het noi dung file*/

#include <fcntl.h>

#include <srllib.h>

#include <dxxxlib.h>

#include <windows.h>

main( )

{

int chdev;

DX_IOTT iott;

DV_TPT tpt;

DV_DIGIT dig;

/* Mo thiet bi su dung dx_open( ) */

if ((chdev = dx_open("dxxxB1C1",NULL)) == -1) {

/* process error */

}

/* set up DX_IOTT */

iott.io_type = IO_DEV|IO_EOT;

iott.io_bufp = 0; /*Con tro den bo nho co so*/

iott.io_offset = 0; /*Bo dem bu*/

iott.io_length = -1; /* chay den het file*/

if((iott.io_handle = dx_fileopen("prompt.vox", O_RDONLY|O_BINARY)) == -1) {

/* process error */

}

/* set up DV_TPT */

dx_clrtpt(&tpt,1);

tpt.tp_type = IO_EOT; /* Chi muc trong bang */

tpt.tp_termno = DX_MAXDTMF; /* So chu so toi da */

tpt.tp_length = 4; /* Ket thuc tai 4 chu so */

tpt.tp_flags = TF_MAXDTMF; /* Su dung co mac dinh */

/* Xoa cac so da nhap trc do */

if (dx_clrdigbuf(chdev) == -1) {

/* process error */

}

/* Chay file */

if (dx_play(chdev,&iott,&tpt,EV_SYNC) == -1) {

/* process error */

}

/* Nhap so su dung dx_getdig( ) Va tiep tuc tien trinh */

if (dx_fileclose(iott.io_handle) == -1) {

/* process error */

}

}

 

 

Bạn đang đọc truyện trên: Truyen2U.Pro