S.F.T. XMODEM Library  1.0
XModem API

Functions

int XReceive (SERIAL_TYPE hSer, const char *szFilename, int nMode)
 Receive a file using XMODEM protocol.
int XSend (SERIAL_TYPE hSer, const char *szFilename)
 Send a file using XMODEM protocol.

Detailed Description

high-level API functions


Function Documentation

int XReceive ( SERIAL_TYPE  hSer,
const char *  szFilename,
int  nMode 
)

Receive a file using XMODEM protocol.

Parameters:
hSerA 'HANDLE' for the open serial connection
szFilenameA pointer to a (const) 0-byte terminated string containing the file name
nModeThe file mode to be used on create (RWX bits)
Returns:
A value of zero on success, negative on failure, positive if canceled

Call this function to receive a file, passing the handle to the open serial connection, and the name and mode of the file to create from the XMODEM stream. The function will return a value of zero on success. On failure or cancelation, the file will be deleted.
If the specified file exists before calling this function, it will be overwritten. If you do not want to unconditionally overwrite an existing file, you should test to see if it exists first.

Definition at line 1427 of file xmodem.c.

int XSend ( SERIAL_TYPE  hSer,
const char *  szFilename 
)

Send a file using XMODEM protocol.

Parameters:
hSerA 'HANDLE' for the open serial connection
szFilenameA pointer to a (const) 0-byte terminated string containing the file name
Returns:
A value of zero on success, negative on failure, positive if canceled

Call this function to receive a file, passing the handle to the open serial connection, and the name and mode of the file to send via the XMODEM stream. The function will return a value of zero on success. If the file does not exist, the function will return a 'failure' value and cancel the transfer.

Definition at line 1479 of file xmodem.c.