SYNOPSIS#include "napi3.h"
RFILE *n_closerfile(SERVER *se,RFILE *rf)
RFILE *n_openrfile(SERVER *se,str fn,str mode)
int n_rread(SERVER *se,RFILE *rf,char *buf,int n)
int n_rwrite(SERVER *se,RFILE *rf,char *buf,int n)
long n_rseek(SERVER *se,RFILE *rf,long off,int where)
DESCRIPTION
The file manipulation functions perform remote versions of the familiar
fopen(3)
, fclose(3)
, read(3)
write(3)
and
seek(3)
functions.
The obvious purpose for these routines is to provide you with the ability to do remotely that which you normally do locally when processing files.
is passed the obligatory SERVER *
, the name of the file to be
opened, and I/O mode of operation . It returns an RFILE *
if all is well or
an RFILEPN
on error. It
is only safe to open file-names that were obtained by
n_getls()
, or the results of a hit callback from a search. This
is because the server's view of the world may be quite different from that
of the client.
is passed a SERVER *
and an open RFILE *
. It will close the
file both locally and remotely.
works more like read()
instead of fread()
because there is
absolutely no point in a sizeof
parameter.
works more like write()
instead of fwrite()
because there is
absolutely no point in a sizeof
parameter.
works like lseek()
to reposition the read/write pointer in an open
file.
Everything that applies to the normal versions of these functions
applies to the remote file routines. The big difference
is that the functions use an RFILE *
instead of an int
as the int
file handle or FILE *
.
CAVEATS
The byte ordering may not be the same on the server as it is on the
client.