Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Anchor10488261048826 FTPc_SendBuf() Anchor10446571044657Sends a file from a memory buffer. Anchor10446581044658

Files

...

ftp-c.h/ftp-c.c

...

Prototype

...

CPU_INT08U *file, CPU_INT32U file_size, CPU_BOOLEAN append, NET_ERR *perr_net);
HTML Table
classCode_Listing
Table Row (tr)
Table Cell (td)
rowspan5
Anchor
10492811049281
Code Block
          CPU_BOOLEAN  FTPc_SendBuf (FTPc_CONN    *p_conn,
                                     CPU_CHAR     *p_remote_file_name,
Anchor
10492821049282
Anchor
10492831049283
Anchor
10492841049284
Anchor
10492851049285
Table Row (tr)
Table Row (tr)
Table Row (tr)
Table Row (tr)

...


                                     CPU_INT08U   *p_buf,
                                     CPU_INT32U    buf_len,
                                     CPU_BOOLEAN   append,
                                     FTPc_ERR     *p_err);

Arguments

p_conn

Pointer to FTPc Connection object.

p_remote_file_name 

Pointer to name of the file on the remote FTP server.

...

p_buf

Pointer to

...

memory buffer

...

to send

...

.

...

buf_len

Size of the memory buffer

...

.

...

append 

Whether to append at the end of the existing file or overwrite content

...

:
DEF_YES, to append data.
DEF_NO,   to overwrite data.

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

Returned Values

...

DEF_OK, File successfully sent;

...


DEF_FAIL, otherwise.

...

Required Configuration

...

None. Anchor10456511045651

Notes / Warnings

...

classCode_Listing

...

rowspan8

...

  • This function can be used when no File System is present to transmit file from a memory buffer.

Example Usage


CPU_BOOLEAN  result
;   result = FTPc_SendBuf((CPU_CHAR *)"test", (CPU_INT08U *)&buf[0], (CPU_INT32U ) BUF_SIZE, (CPU_BOOLEAN ) DEF_FALSE, (NET_ERR *)&err); if (result != DEF_OK) {
;
FTPc_ERR     err;

result = FTPc_SendBuf(&conn,
                      "test",
                      &buf[0],
                       BUF_SIZE,
                       DEF_NO,
                      &err);
if (result != DEF_OK) {
    printf("FTPc_SendBuf() failed.\n\r");
}tr

}
Code Block
#define  BUF_SIZE    1024

FTPc_CONN    conn;           
CPU_INT08U   buf[BUF_SIZE];
Anchor
10484581048458
Anchor
10484631048463
Anchor
10493471049347
Anchor
10484641048464
Anchor
10484651048465
Anchor
10484661048466
Anchor
10484671048467
Anchor
10484681048468
Anchor
10484691048469
Anchor
10461171046117
Table Row (tr)
Table Row (tr)
Table Row (tr)
Table Row (tr)
Table Row (tr)
Table Row (tr)