Gambas Documentation
Como se hace...
Compilación e instalación
Componentes
Controls pictures
Descripciones del Lenguaje
Developer Documentation
Componentes adicionales de Gambas
Cómo programar componentes en C/C++
Cómo programar componentes en Gambas
Índice Alfabético de la Interfaz de Programación de Gambas
Índice por Categorías de la Interfaz de Programación de Gambas
Name
ARG
BEGIN_METHOD_VOID
BEGIN_PROPERTY
END_METHOD
GB.Add
GB.Alloc
GB.Application.Name
GB.Application.Title
GB.Array.Count
GB.CheckPost
GB.CurrentComponent
GB.Detach
GB.ExistClass
GB.ExistFile
GB.FileName
GB.Free
GB.FreeArray
GB.FreeString
GB.GetClass
GB.GetClassName
GB.GetEnum
GB.GetEvent
GB.GetFunction
GB.GetTempDir
GB.GetTime
GB.GetUnknown
GB.Is
GB.ListEnum
GB.LoadComponent
GB.NewString
GB.NextEnum
GB.Propagate
GB.Push
GB.Realloc
GB.Ref
GB.ReleaseFile
GB.ReturnFloat
GB.ReturnLong
GB.ReturnObject
GB.StopAllEnum
GB.StopEnum
GB.StoreObject
GB.StoreString
GB.StoreVariant
GB.System.Language
GB.Unref
GB.Watch
GB_ARRAY
GB_FLOAT
GB_HOOK_LOOP
GB_HOOK_MAIN
GB_HOOK_POST
GB_HOOK_TIMER
GB_STRING
GB_T_BOOLEAN
GB_T_BYTE
GB_T_DATE
GB_T_FLOAT
GB_T_INTEGER
GB_T_LONG
GB_T_SHORT
GB_T_SINGLE
GB_T_STRING
GB_T_VARIANT
GB_TIMER
PROP
VPROP
Documentacion y Recetas
Documentación del Entorno de Desarrollo
Fragmentos de código
Glosario
Índice del Lenguaje
LÉEME
Licencia del Wiki
Manual del Wiki
Mensajes de Error
Pendiente de traducción
Registrarse
Repositorio de Aplicaciones
Tutoriales
Últimos cambios

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 stream.

Each stream 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 stream.

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 stream cannot be opened, and FALSE if everything is OK.
close Closes the stream. FALSE.
read Reads len bytes into the stream, 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 stream. 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 stream.
  • pos is the position inside the stream.

  • 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 stream.

TRUE if seeking is impossible, and FALSE if everything is OK.
tell Returns the current stream position in pos. TRUE if seeking is impossible, and FALSE if everything is OK.
flush Flushes the stream. TRUE if there was an error, and FALSE if everything is OK.

If flushing has no sense for your stream, then you must return FALSE.
eof Checks the end of the stream. TRUE if the end of the stream is reached, FALSE otherwise.
lof Returns in len the length of the stream.

If this has no sense for your stream, 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 stream for you, by putting 0 in len.
FALSE.
handle Returns the underlying system file descriptor. The underlying system file descriptor.

See also