Gambas Documentation
Application Repository
Code Snippets
Compilation & Installation from source code
Components
Controls pictures
Deprecated components
Developer Documentation
'gb.qt' implementation details
Additional Gambas Components
Gambas Programming Interface
Cat
Name
ARG
BEGIN_METHOD
BEGIN_METHOD_VOID
BEGIN_PROPERTY
DECLARE_EVENT
DECLARE_METHOD
DECLARE_PROPERTY
END_METHOD
END_PROPERTY
GB.Add
GB.AddString
GB.Alloc
GB.Application.Name
GB.Application.Path
GB.Application.Startup
GB.Application.Title
GB.Application.Version
GB.Array.Add
GB.Array.Count
GB.Array.Get
GB.Array.New
GB.Attach
GB.AutoCreate
GB.Call
GB.CanRaise
GB.CheckObject
GB.CheckPost
GB.Collection.Count
GB.Collection.Get
GB.Collection.New
GB.Collection.Set
GB.Conv
GB.ConvString
GB.Count
GB.CurrentComponent
GB.Detach
GB.Error
GB.ExistClass
GB.ExistFile
GB.ExtendString
GB.FileName
GB.FindClass
GB.Free
GB.FreeArray
GB.FreeString
GB.GetClass
GB.GetClassName
GB.GetEnum
GB.GetEvent
GB.GetFunction
GB.GetInterface
GB.GetTempDir
GB.GetTime
GB.GetUnknown
GB.HashTable.Add
GB.HashTable.Count
GB.HashTable.Enum
GB.HashTable.Free
GB.HashTable.Get
GB.HashTable.New
GB.HashTable.Remove
GB.Hook
GB.Insert
GB.Is
GB.IsProperty
GB.ListEnum
GB.LoadComponent
GB.LoadFile
GB.MakeDate
GB.MakeDateFromTime
GB.MatchString
GB.New
GB.NewArray
GB.NewString
GB.NewZeroString
GB.NextEnum
GB.NParam
GB.NumberFromString
GB.NumberToString
GB.Post
GB.Propagate
GB.Push
GB.Raise
GB.RaiseTimer
GB.RealFileName
GB.Realloc
GB.Ref
GB.ReleaseFile
GB.Remove
GB.ReturnBoolean
GB.ReturnConstString
GB.ReturnConstZeroString
GB.ReturnDate
GB.ReturnFloat
GB.ReturnInteger
GB.ReturnLong
GB.ReturnNewString
GB.ReturnNewZeroString
GB.ReturnNull
GB.ReturnObject
GB.ReturnPtr
GB.ReturnString
GB.SplitDate
GB.StopAllEnum
GB.StopEnum
GB.Store
GB.StoreObject
GB.StoreString
GB.StoreVariant
GB.strcasecmp
GB.Stream.Init
GB.StringLength
GB.strncasecmp
GB.SubstAdd
GB.SubstString
GB.System.Charset
GB.System.Language
GB.tolower
GB.toupper
GB.ToZeroString
GB.Unref
GB.UnRefKeep
GB.Watch
GB_ARRAY
GB_AUTO_CREATABLE
GB_BASE
GB_BOOLEAN
GB_CLASS
GB_COLLECTION
GB_COMP_BINARY
GB_COMP_TEXT
GB_CONSTANT
GB_DATE
GB_DATE_SERIAL
GB_DECLARE
GB_DESC
GB_END_DECLARE
GB_ERR_ARG
GB_ERR_BOUND
GB_ERR_NPROPERTY
GB_ERR_NSYMBOL
GB_ERR_TYPE
GB_EVENT
GB_FLOAT
GB_FUNCTION
GB_HASHTABLE
GB_HASHTABLE_ENUM_FUNC
GB_HOOK_CHECK
GB_HOOK_ERROR
GB_HOOK_LANG
GB_HOOK_LOOP
GB_HOOK_MAIN
GB_HOOK_POST
GB_HOOK_QUIT
GB_HOOK_TIMER
GB_HOOK_WAIT
GB_HOOK_WATCH
GB_INHERITS
GB_INTEGER
GB_LONG
GB_METHOD
GB_NB_LOCAL
GB_NB_READ_ALL
GB_NB_READ_FLOAT
GB_NB_READ_HEX_BIN
GB_NB_READ_INT_LONG
GB_NB_READ_INTEGER
GB_NB_READ_LONG
GB_NOT_CREATABLE
GB_OBJECT
GB_POINTER
GB_PROPERTY
GB_PROPERTY_READ
GB_PROPERTY_SELF
GB_SINGLE
GB_STATIC_METHOD
GB_STATIC_PROPERTY
GB_STATIC_PROPERTY_READ
GB_STATIC_PROPERTY_SELF
GB_STREAM
GB_STREAM_DESC
GB_STRING
GB_SUBST_CALLBACK
GB_T_BOOLEAN
GB_T_BYTE
GB_T_CSTRING
GB_T_DATE
GB_T_FLOAT
GB_T_INTEGER
GB_T_LONG
GB_T_NULL
GB_T_OBJECT
GB_T_POINTER
GB_T_SHORT
GB_T_SINGLE
GB_T_STRING
GB_T_VARIANT
GB_T_VOID
GB_TIMER
GB_TYPE
GB_VALUE
GB_VARIANT
GB_VIRTUAL_CLASS
GB_WATCH_CALLBACK
GB_WATCH_NONE
GB_WATCH_READ
GB_WATCH_READ_WRITE
GB_WATCH_WRITE
LENGTH
MISSING
PLENGTH
PROP
PSTRING
READ_PROPERTY
RETURN_SELF
STRING
VARG
VARGOPT
VPROP
How To Program Components In C/C++
How To Program Components In Gambas
Development Environment Documentation
Documents
Error Messages
Gambas Playground
How To's
Language Index
Language Overviews
Last Changes
Lexicon
README
Search the wiki
To Do
Topics
Tutorials
Wiki License
Wiki Manual

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