Principal > dev > api > name > gb_stream_desc 
 en fr de it nl pl pt pt_BR mk sq ca hu cs tr ar fa id vi ko ja ru zh zh_TW eo
Previo  Siguiente  Editar  Renombrar  Deshacer  Buscar  Administración  
Documentación  
¡Precaución! La página no está traducida.  Véase la versión inglesa 
GB_STREAM_DESC
struct GB_STREAM;

typedef   struct {     int (*open)(struct GB_STREAM *stream, const char *path, int mode, void *data);     int (*close)(struct GB_STREAM *stream);     int (*read)(struct GB_STREAM *stream, char *buffer, long len);     int (*write)(struct GB_STREAM *stream, char *buffer, long len);     int (*seek)(struct GB_STREAM *stream, long long pos, int whence);     int (*tell)(struct GB_STREAM *stream, long long *pos);     int (*flush)(struct GB_STREAM *stream);     int (*eof)(struct GB_STREAM *stream);     int (*lof)(struct GB_STREAM *stream, long long *len);     int (*handle)(struct GB_STREAM *stream);     } GB_STREAM_DESC;

This describe is a function pointer table that must point at the implementation functions of a Flujo.

Each Flujo has a pointer to such a structure. See GB_STREAM for more details.

Function What should be done What should be returned
open Opens the Flujo.

This function is never called directly by the interpreter, as you must open the file yourself, by instanciating the Stream Gambas object, and by filling the GB_STREAM structure appropriately.

TRUE if the Flujo cannot be opened, and FALSE if everything is OK.
close Closes the Flujo. FALSE.
read Reads len bytes into the Flujo, and fills the buffer with them. TRUE if there was an error, and FALSE if everything is OK.

The errno code is used by the interpreter to choose the error message.

write Writes the len bytes located at buffer to the Flujo. TRUE if there was an error, and FALSE if everything is OK.

The errno code is used by the interpreter to choose the error message.

seek Seeks into the Flujo.
  • pos is the position inside the Flujo.
  • whence is one the following constants:
    • SEEK_SET, to indicate that pos is an absolute position.
    • SEEK_CUR, to indicate that pos is an offset to the current position.
    • SEEK_END, to indicate that pos is an offset from the end of the Flujo.
TRUE if seeking is impossible, and FALSE if everything is OK.
tell Returns the current Flujo position in pos. TRUE if seeking is impossible, and FALSE if everything is OK.
flush Flushes the Flujo. TRUE if there was an error, and FALSE if everything is OK.

If flushing has no sense for your Flujo, then you must return FALSE.

eof Checks the end of the Flujo. TRUE if the end of the Flujo is reached, FALSE otherwise.
lof Returns in len the length of the Flujo.

If this has no sense for your Flujo, and if the handle function returns a system file descriptor, you can let the interpreter returns the maximum number of bytes that can be read on the Flujo for you, by putting 0 in len.

FALSE.
handle Returns the underlying system file descriptor. The underlying system file descriptor.

Véase también

api/cat/stream