Finalmente o Przemek terminou as prometidas funções para usarmos via protocolo TCP.
Código: Selecionar todos
hb_xRead("127.0.0.1:2941",FO_NORMAL)...
ou
pSocket := hb_XOpen( "tcp:127.0.0.1:2941", FO_READWRITE )
pGZipPipe := hb_XOpen( "|gzip > data.gz", FO_WRITE )
pFtp := hb_XOpen( "ftp:user:pass@192.168.1.12:/pub/archive.tgz",FO_READ )
+ added PRG interface to Harbour FILE IO API
The following PRG functions are available for Harbour programmers:
HB_XEXISTS( <cFileName>, [ @<cDestFileName> ] ) -> <lOK>
HB_XERASE( <cFileName> ) -> <nResult>
HB_XRENAME( <cFileSrc>, <cFileDst> ) -> <nResult>
HB_XCOPYFILE( <cFileSrc>, <cFileDst> ) -> <nResult>
HB_XDIREXISTS( <cDirName> ) -> <lExists>
HB_XDIRMAKE( <cDirName> ) -> <nSuccess>
HB_XDIRREMOVE( <cDirName> ) -> <nSuccess>
HB_XDIRECTORY( [ <cDirSpec> ], [ <cAttr> ] ) -> <aDirectory>
HB_XDIRSPACE( <cDirName>, [ <nInfoType> ] ) -> <nFreeSpace>
HB_XGETATTR( <cFileName>, @<nAttr> ) -> <lOK>
HB_XSETATTR( <cFileName>, <nAttr> ) -> <lOK>
HB_XGETDATETIME( <cFileName>, @<tsDateTime> ) -> <lOK>
HB_XSETDATETIME( <cFileName>, <tsDateTime> ) -> <lOK>
HB_XLINK( <cExistingFileName>, <cNewFileName> ) -> <nSuccess>
HB_XLINKSYM( <cTargetFileName>, <cNewFileName> ) -> <nSuccess>
HB_XLINKREAD( <cFileName> ) -> <cDestFileName> | ""
HB_XOPEN( <cFileName>, [ <nMode> ], [ <nAttr> ] ) -> <pHandle> | NIL
HB_XCLOSE( <pHandle> ) -> <lOK>
HB_XLOCK( <pHandle>, <nStart>, <nLen>, [ <nType> ] ) -> <lOK>
HB_XUNLOCK( <pHandle>, <nStart>, <nLen> ) -> <lOK>
HB_XLOCKTEST( <pHandle>, <nStart>, <nLen>, [ <nType> ] ) ;
-> <nPID> | 0 (nolock) | -1 (err)
HB_XREAD( <pHandle>, @<cBuff>, [ <nToRead> ], [ <nTimeOut> ] ) ;
-> <nRead>
HB_XWRITE( <pHandle>, <cBuff>, [ <nToWrite> ], [ <nTimeOut> ] ) ;
-> <nWritten>
HB_XREADAT( <pHandle>, @<cBuff>, [ <nToRead> ], [ <nAtOffset> ] ) ;
-> <nRead>
HB_XWRITEAT( <pHandle>, <cBuff>, [ <nToWrite> ], [ <nAtOffset> ] ) ;
-> <nWritten>
HB_XSEEK( <pHandle>, <nOffset>, [ <nWhence> ] ) -> <nOffset>
HB_XTRUNC( <pHandle>, [ <nAtOffset> ] ) -> <lOK>
HB_XSIZE( <pHandle> ) -> <nSize>
HB_XEOF( <pHandle> ) -> <lEOF>
HB_XFLUSH( <pHandle>, [ <lDirtyOnly> ] ) -> NIL
HB_XCOMMIT( <pHandle> ) -> NIL
HB_XCONFIG( <pHandle>, <nSet>, [ <nParam> ] ) -> <nResult>
HB_XHANDLE( <pHandle> ) -> <nOsHandle>
HB_XTEMPFILE( @<cFileName>, [ <cDir> ], [ <cPrefix> ], [ <cExt> ], ;
[ <nAttr> ] ) -> <pHandle> | NIL
Please remember that not all redirectors have to support all of them.
I.e. MEMIO allows to use directory names in files but does not allow to
create or remove directories. It also does not support file attributes
and times in current implementation though it can be easy added.
HB_XCONFIG() is general function which can be used by redirector
authors to make some special operations which are specific to given
device.
HB_XTEMPFILE() always creates temporary files on local system without
switching to FILE IO redirector. It's intentional behavior.
* src/rtl/fscopy.c
* used Harbour FILE IO API in hb_fsCopy()/HB_FCOPY()
Please remember that HB_FCOPY() always makes operation using current
system when HB_XCOPY() may optimize it moving the operation to low
level subsystem or even other computer i.e. NETIO can do that when
both files are located on the same server.
Saudações,
Itamar M. Lins Jr.


