76 lines
2.0 KiB
Plaintext
76 lines
2.0 KiB
Plaintext
P7_SEND(3)
|
|
==========
|
|
Thomas "Cakeisalie5" Touhey
|
|
:Email: thomas@touhey.fr
|
|
:man source: libp7
|
|
:man manual: libp7 manual
|
|
|
|
NAME
|
|
----
|
|
p7_send, p7_sendfile - send a file to the calculator
|
|
|
|
SYNOPSIS
|
|
--------
|
|
[source,c]
|
|
----
|
|
#include <libp7.h>
|
|
|
|
int p7_send(p7_handle_t *handle, p7_buffer_t *buffer,
|
|
const char *dirname, const char *filename, const char *devname,
|
|
int overwrite, int (*ow_conf)(), void (*disp)());
|
|
int p7_sendfile(p7_handle_t *handle, FILE *file,
|
|
const char *dirname, const char *filename, const char *devname,
|
|
int overwrite, int (*ow_conf)(), void (*disp)());
|
|
|
|
FILE *fp = fopen("myaddin.g1a", "r");
|
|
p7_sendfile(handle, fp, "dir", "myaddin.g1a", "fls0", 1, NULL, NULL);
|
|
----
|
|
|
|
DESCRIPTION
|
|
-----------
|
|
These functions are used to send a file to the calculator. *p7_send* uses the
|
|
libp7 buffer interface, see *p7_buffer*(3) to read more about it.
|
|
|
|
*filename* is the filename the file will take on the distant device. *dirname*
|
|
is the name of the directory it will go in - if it is NULL, file will go at
|
|
root. *devname* is the storage device name (usually "fls0" or "crd0").
|
|
|
|
In case the file exists on the calculator, we have to either accept or deny
|
|
the overwrite. If the overwrite confirmation callback, *ow_conf*, is not NULL,
|
|
it is called in this case. This function generally asks the user if he wants to
|
|
overwrite. It must have this prototype:
|
|
|
|
[source,c]
|
|
----
|
|
int my_overwrite_confirmation(void);
|
|
----
|
|
|
|
A non-zero answer is interpreted as a "yes", and a nil answer is interpreted
|
|
as a "no". *overwrite* is the "default" answer, it will be read if *ow_conf*
|
|
is NULL.
|
|
|
|
The *disp* parameter is only there if you want to display a loading bar. It
|
|
should have this prototype:
|
|
|
|
[source,c]
|
|
----
|
|
void my_display(p7ushort_t id, p7ushort_t total);
|
|
----
|
|
|
|
If it is non-null, it is first called with *id* > *total* to initialize display.
|
|
|
|
RETURN VALUE
|
|
------------
|
|
Both functions return zero if everything went well, and the error code
|
|
otherwise.
|
|
|
|
ERRORS
|
|
------
|
|
See *p7_error*(3).
|
|
|
|
SEE ALSO
|
|
--------
|
|
*libp7*(3),
|
|
*p7_request*(3),
|
|
*p7_error*(3)
|