On Thu, 17 Sep 2009, Alex Strickland wrote:
>> I just want to ask if it is feasible to add HB_ReadIni() support to
>> HBNETIO?
> Although I have not used this yet, I think you must just pass the ini file
> name with the "net:" prefix and it will automagically do what you want.
It does not yet.
Now only code which uses internally hb_file*() functions can be redirected
to user defined IO API. All core RDDs use hb_file*() functions so they will
work with NETIO. hb_ini*() functions internally use FOPEN()/FCREATE() which
still operates on raw file handles so canno be redirected to user defined
IO API.
In the future I plan to add full support for virtual file handles so
all functions will support it. Here is entry I added to harbour/TODO
long time ago:
Assign to: <nobody>
Detail...: Add support for virtual file handles and registering some
meta handles so it will be possible to make:
h := fopen( "gzip:/tmp/myarchive.gz", FO_WRITE )
fwrite( h, cData )
fclose( h )
or:
h := fopen( "tcp:some.host:port", FO_WRITE )
...
or:
h := fopen( "|lpr -PLaserJet", FO_WRITE )
...
or:
h := fopen( "gunzip /tmp/myarchive.gz|", FO_READ )
...
etc.
Status...: Open.
Anyone will be able to create new alternative file IO, i.e. someone
can register code which allows to transfer files via FTP, i.e.:
hSrc := fopen( "ftp:192.168.1.53:user:pass:/dir/file.txt", FO_READ )
if hSrc != F_ERROR
while ( n := fread( hSrc, @buf, len( buf ) ) ) > 0
fwrite( hDst, buf, len )
enddo
fclose( hSrc )
endif
Of course some alternative IO APIs may not support all functionality
which exists in local file systems, i.e. fseek() will not work for
streams but it's not a problem - they will simply return errors.
Now I want to see how netio will work and decide if I should add new
set of functions like:
hb_fopen(), hb_fcreate(), hb_fclose(), hb_fread(), ...
or change existing one fopen(), fcreate(), fclose(), fread(), ...
to internally operate on hb_file*() API.
best regards,
Przemek
_______________________________________________
Harbour mailing list
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour