
Description | Cautions | Example | Source Code | Errors | See Also
Name: |
int fx_sendascii(faxname, phdcont) | |
Inputs: |
char * faxname |
ASCII filename |
|
unsigned short phdcont |
Phase D continuation value |
Returns: |
0 if success | |
|
-1 if failure | |
Includes: |
srllib.h | |
|
dxxxlib.h | |
|
faxlib.h | |
Category: |
send fax | |
Mode: |
synchronous | |
|
||
The fx_sendascii( ) function allows an application to send a single ASCII file at the default width, length, resolution, fonts and margins for ASCII data. For default ASCII information, see Section 7.3. DF_ASCIIDATA -- ASCII Data Description on page 101.
This function is a convenience function and resides in faxconv.c. The fx_sendascii( ) function calls fx_sendfax( ) (see source code for fx_sendascii( )). The fx_sendfax( ) function reference contains information on Phase D continuation values, status information and file error handling that applies to fx_sendascii( ).
The encoding scheme used in transmitting fax data varies by product; for more information see Section 2.4. Key Product Features on page 8. The preferred encoding scheme for transmission is determined by the value set in the FC_TXCODING parameter in fx_setparm( ).
#include <stdio.h>
#include <windows.h>
#include <srllib.h>
#include <dxxxlib.h>
#include <faxlib.h>
int voxhandle; /* Voice channel device handle. */
int devhandle; /* Fax channel device handle. */
/*
* Open the channel using dx_open( ) to obtain the Dialogic
* VOICE device handle in voxhandle.
* Open the channel using fx_open( ) to obtain the FAX channel
* device handle in devhandle.
*/
/*
* Take channel offhook using dx_sethook( ) and perform outbound
* dial using dx_dial( ).
*/
.
.
/*
* Send the ASCII file. No more files to send (DFC_EOP).
*/
if (fx_sendascii("textdata.txt",DFC_EOP) == -1) {
printf("Error - %s (error code %d)\n",
ATDV_ERRMSGP(devhandle), ATDV_LASTERR(devhandle));
if (ATDV_LASTERR(devhandle) == EDX_SYSTEM) {
/* Perform system error processing */
}
printf("Phase E status: %ld\n", ATFX_ESTAT(devhandle));
/* Application specific error handling. */
.
.
}
Source Code for fx_sendascii( )
/*
* NOTE: devhandle is a global variable of type int. Prior
* to calling fx_sendascii( ), the channel is opened
* using fx_open( ) to obtain the Dialogic FAX channel device
* handle in devhandle.
*/
DF_IOTT iott;
int fx_sendascii(faxname,phdcont)
char * faxname;
unsigned short phdcont
{
int erc;
/* Open the file as read-only. */
if ((iott.io_fhandle = dx_fileopen(faxname,O_RDONLY|O_BINARY,0)) == -1) {
return(-1);
}
/*
* Set up the DF_IOTT structure as the default and then
* change the necessary fields.
*/
fx_setiott(&iott,iott.io_fhandle,DF_ASCII,phdcont);
iott.io_type |= IO_EOT;
erc = fx_sendfax(devhandle,&iott, EV_SYNC)
dx_fileclose(iott.io_fhandle);
return(erc);
}
See Appendix D for a list of common error codes that may be returned for this function.
Click here to contact Dialogic Customer Engineering
Copyright 2002, Intel Corporation