Type: keyword
Category: file mode
The RANDOM keyword is used with the OPEN statement which
opens the file with the RANDOM file mode.
The RANDOM file mode allows you to read/write records at any point of the file (unlike
sequential access of the append file mode).
See this external resource for examples and more info:
http://www.petesqbsite.com/sections/express/issue6/index.html#randomaccessfiles.
get (file i/o), put (file
i/o), binary, append,
output, input (file mode),
field.
Type: statement
Sets the random seed that helps rnd generate random numbers. For good results,
using a seed that is not quite predictable provides good results for random
numbers.
An example of this is the number of milliseconds past midnight (timer).
e.g.
See also rnd.
Type: statement
Reads data stored in the application with the data
command.
See data for an example.
Syntax: (function( byval src as any ptr, byval bytes as integer ) as any ptr)
Type: function
Differences:
New to FreeBasic.
Type: statement
Changes the size of an array (upper and lower bounds). Using redim to declare
an array first forces it to be a dynamic array, where as dim
forces an array to be static unless the metacommand $dynamic
is used.
DIM|REDIM array w/o explicit dimensions is not allowed anymore inside procs, as
the descriptor size is unknown (v1c)
e.g. on using dynamic arrays:
Syntax: rem comment
Type: statement
REM is the same as a comment symbol ('). It comments out text. Usually for
helpful notes.
e.g.
Type: statement
Category: File
Closes all disk files.
See also open, close.
- resource files support on Windows, just add the .rc's or .res' to the list,
they will be automatically
compiled -- the Windows C headers were also added, so complex scripts (ie:
dialogs and menus) can be
used too (DrV)
Type: statement
Chooses which embedded data to read from. If your application has a great
deal of data embedded within itself, restore allows one to organise the data and
select which set of data to start reading from using labels.
Small example:
This example only has a small amount of data, however other applications may
have a great deal of data to sort through and restore is useful in this case.
See also data, read.
Type: statement
Category: Error
RESUME and RESUME NEXT error handling intrinsic functions (v1c)
Type: statement
Returns from a gosub call.
RETURN can now be used as a shortcut to function result set + EXIT FUNCTION (as
in C); with this modification,
the LABEL's (if used) must have been defined already, no forward references are
allowed anymore (v1c)
See gosub.
Syntax: rgb(red, green, blue)
Type: function intrinsic
macro
RGB is now an intrinsic macro, not a function (so no UDT's called RGB are
allowed anymore) (v1c)
Category: Gfx
Function to compute valid color value for hi/truecolor modes.
'Red', 'green' and 'blue' are components ranging 0-255.
The RGB function can be used to compure a valid color value for use while in hi/truecolor
modes. It returns a number in the format &hRRGGBB, where RR, GG and BB equals
the values passed to this function, in hexadecimal format.
Example:
See PUT (graphics) example.
See also color.
Differences:
New to FreeBasic.
Syntax: right$(text$, n)
Type: function
returns 'n' amount of characters starting from the right of 'text$' string.
e.g.
See also left$, mid$ (function).
Syntax: rmdir folder$
Type: statement
Category: File
Removes a folder from the file system.
e.g. if a folder called "foo" exists and you want it removed:
Syntax: rnd
Type: function
Returns a decimal (floating point) number between 0 and 1, based off the
random seed (see randomize).
See also randomize.
Differences:
Between QB:
There's no always-0 argument.
Syntax: rset string_var, string_expression
Type: statement
Category: File
RSET right justifies text into the string buffer 'string_var', filling the
right part of the string with 'string_expression' and the left part with spaces.
e.g.
See also lset, space$,
put (file i/o), mkd$,
mki$, mkl$, mks$.
Differences:
Between QB:
syntax is "RSET dst, src" not "RSET dst = src"
Type: function
Rtrim (right trim) trims the trailing white space from string.
e.g.
See also ltrim$.
Syntax: run file$
Type: statement
Category: Misc
Run will run an executable file (file$) in the file system. After the
executable has ended, control will not return to the original caller program,
but return to the system.
For example, if the executable "file.exe" exists in the current folder this code
will execute it:
See also chain.
Differences:
Between QB:
needs the full executable name including extension (.exe).