FTPc_RecvBuf
Receives a file into a memory buffer.
Files
ftp-c.h/ftp-c.c
Prototype
CPU_BOOLEAN FTPc_RecvBuf (FTPc_CONN *p_conn, CPU_CHAR *p_remote_file_name, CPU_INT08U *p_buf, CPU_INT32U buf_len, CPU_INT32U p_file_size, FTPc_ERR *p_err);
Arguments
p_conn
Pointer to FTPc Connection object.
p_remote_file_name
Pointer to name of the file in FTP server.
p_buf
Pointer to memory buffer to hold received file.
buf_len
Size of the memory buffer.
p_file_size
Variable that will received the size of the file received.
p_err
Pointer to variable that will receive the return error code from this function:
FTPc_ERR_NONE
FTPc_ERR_TX_CMD
FTPc_ERR_RX_CMD_RESP_FAIL
FTPc_ERR_FILE_BUF_LEN
Returned Values
DEF_OK
, File successfully received;DEF_FAIL
, otherwise.
Required Configuration
None.
Notes / Warnings
- This function can be used when no File System is present to receive file in a memory buffer.
Example Usage
#define BUF_SIZE 1024 FTPc_CONN conn; CPU_INT08U buf[BUF_SIZE]; CPU_BOOLEAN result; CPU_INT32U file_size; FTPc_ERR err; result = FTPc_RecvBuf(&conn "test", &buf[0], BUF_SIZE, &file_size; &err); if (result != DEF_OK) { printf("FTPc_RecvBuf() failed.\n\r"); }