Syntax: CALL subname ([parameter list])
Type: statement
Calls a sub like in this code snipet:
This is old syntax compadibile from the oldest basic dialects. This can be
better coded like so:
Differences:
Between QB:
Function must have been declared already.
same as ALLOCATE, but clears the contents.
Differences:
New to FreeBasic.
Type: statement
Redundant, and the same as call. Kept for compadibility reasons.
Differences:
Between QB:
Function must have be declared already.
Type: keyword
Category: control flow
See select case.
Type: function
Converts any numeric expression to a byte.
CUBYTE, CUSHORT and CUINT, same as CBYTE, CSHORT and CINT, but work with
unsigned types (v1c)
e.g. this will try convert 260 into 8-bits.
Differences:
New to FreeBasic.
Type: function
Converts any numeric expression to a double-precision
number.
cDbl can be explained like so: C-DBL, C (convert) Dbl (double).
Syntax: declare {function | sub} procName cdecl alias
Type: calling convention
Stands for C-Declare, which when used with a declare statement passes the
variables from right to left (cc++ convention), rather than left to right (fb
convention).
e.g. declaring 'pixelColor' from the SDL library.
----------------
I've no clue how VB will "mangle" the imported names, try adding ALIAS
"AddNumbers@8" to the VB prototype, or declare it as CDECL at the FB side and as
ALIAS "_AddNumbers" at VB.
---------------
See also declare, pascal,
stdcall.
Differences:
New to FreeBasic.
Type: statement
Runs another program and transfers control to that program. After called
program has ended the original program will gain the control again.
See also run.
Differences:
Between QB:
Calling process will continue running after called process finish, rather than
not (like in qb).
Syntax: chdir pathspec
Type: statement
Category: File
Changes the current directory.
If in windows or dos, this changes the current directory on the given drive but
does not change the default drive. You must change (v1c, not finished)
Syntax: CHR$(byte)
Type: function
Returns the ascii character of the byte given, returned in a single-character
string format.
CHR$ now accepts multiple arguments as in "s = chr$( 65, 66, 67, 68 )" (v1c)
This is useful for accessing symbol's not on the keyboard.
Type: function
Converts any number to an integer by removing the fractional part.
CUBYTE, CUSHORT and CUINT, same as CBYTE, CSHORT and CINT, but work with
unsigned types (v1c)
See also int.
Syntax: CIRCLE [STEP] (x,y), radius[, [color][, [start][, [end][, [aspect][,
F]]]]]
Type: statement
Category: Gfx
Statement to draw circles, ellipses or arcs.
The 'STEP' option specify that x and y are offsets relative to the current
graphics cursor position.
'x' and 'y' are coordinates of the center of the circle/ellipse.
'radius' is simply the radius of the circle (or major axis radius of an ellise).
'color' is the color attribute. This is mode specific, see
COLOR and SCREEN (graphics) for details.
'start' and 'end' are angles are in radians. These can range -2PI to 2PI; if you
specify a negative angle, its value is changed sign and a line is drawn from the
center up to that point in the arc. End angle can be less than start angle. If
you do not specify start and end, a full circle/ellipse is drawn; if you you
specify start but not end, end is assumed to be 2PI; if you specify end but not
start, start is assumed to be 0.
'aspect' is the aspect ratio, or the ratio of the y radius over the x radius.
The default value is the value required to draw a perfect circle on the screen,
keeping pixel aspect ratio in mind.
So this value can be calculated as follows:
Where pixel_aspect_ratio is the ratio of the current mode width over the current
mode height, assuming a 4:3 standard monitor. If aspect ratio is less than 1,
radius is the x radius; if aspect is more or equal to 1, radius is the y radius.
'f' is the fill flag. If you specify this flag, the circle/ellipse will be
filled with the selected color. This has no effect if you're drawing an arc.
Use this function to draw circles, ellipses or arcs. Custom coordinates system
set up by WINDOW and/or VIEW
(graphics) affect the drawing operation; clipping set by VIEW also applies.
When CIRCLE finishes drawing, the current graphics cursor position is set to the
supplied center.
e.g.
See also screen (graphics),
color.
Differences:
Between QB:
As this function uses a different algorithm from the one used in QB, circles,
ellipses and arcs may not be equal pixel-by-pixel to those produced by QB. In
addition, this version supports filled circles/ellipses via the F flag, whereas
QB doesn't.
Syntax: clear pointer, value, bytecount
Type: statement
Resets all values in an array to what you want (usually 0 is useful).
e.g.
See also dim.
Type: function
Converts any number to a long number. The name can be explained by c-lng (c for convert, lng for long).
Type: statement
Closes one file (in a given file slot #) or closes all files (with no parameter given).
Syntax: CLS
Type: statement
Category: Console
Clears the console screen.
Differences:
Between QB:
There's no optional argument, the whole screen is cleared.
Syntax: COLOR [foreground][,background]
Type: statement
Category: Gfx
Sets the display foreground / background color that is used with console
output and graphics output of text.
The COLOR statement sets the current foreground and/or background colors.
CIRCLE, DRAW,
LINE (graphics), CLS,
PAINT, PRINT and PSET
all use the last colors set by this function when you don't specify a color to
them, where applicable. The color values COLOR accepts depend on the current gfx
mode.
Mode 1: foreground is screen color (ranging 0-15). background modulo 4 is the emulated CGA palette to be used: 0: green, red, and brown. 1: cyan, magenta and white. 2: same as 0, but with bright colors. 3: same as 1, but with bright colors. Modes 2 and 11: foreground is a color index in current palette (ranging 0-1). background is a color index in current palette (ranging 0-1). Modes 7 and 8: foreground is a color index in current palette (ranging 0-15). background is screen color index in current palette (ranging 0-15). Mode 9: foreground is a color index in current palette (ranging 0-63). background is screen color index in current palette (ranging 0-63). Mode 12: foreground is a color index in current palette (ranging 0-15). background is a color index in current palette (ranging 0-15). Modes 13 and up: foreground is a color index in current palette (ranging 0-255). background is a color index in current palette (ranging 0-255).
If you are using a color depth higher than 8bpp, foreground and background are
direct RGB color values in the form &hRRGGBB, where RR, GG
and BB are the red, green and blue components ranging &h00-&hFF (0-255 in
decimal notation). While in hi/truecolor modes, you can also use the
RGB function to obtain a valid color value.
e.g.
See also screen (graphics),
palette.
Differences:
Betweeen QB:
Foreground range: 0..15, background range: 0..7; there's no border argument.
FB version accepts direct color values in hi/truecolor modes; COLOR in screen
mode 1 accepts 4 different CGA palettes instead of the 2 supported by QB.
Type: function
Returns command line parameters used to call the program.
COMMAND$ can now return just a specific argument as in "argv3 = command$(3)"
(v1c)
Type: statement
Shares variables between modules.
No example as of now.
See also dim, sub,
function.
Differences:
Between QB:
Arrays are ALWAYS dynamic; no sharing between processes.
special file names, to open the console for i/o access and the std
error for output (v1c)
ERR:
Type: statement
Creates symbols which act as a constant (a integer/decimal number or string).
string constant expressions can now be used with CONST's (v1c)
e.g. to make the symbol 'red' to 4 and 'blue' to 1 you would do:
Or to create a string constant:
Syntax: continue {do | for | while}
Type: statement
Re-enters a code block such as a do...loop,
for...next, or a while...wend
block.
e.g. the second and third print command will not be seen. (Warning, infinite
loop - press ctrl+break to exit!)
See also exit.
Differences:
New to FreeBasic.
Syntax: COS (angle as single)
Type: function
Category: math
Returns the cosine of the angle (given in radians).
Converts any numeric expression to a short integer
(16-bit).
CUBYTE, CUSHORT and CUINT, same as CBYTE, CSHORT and CINT, but work with
unsigned types (v1c)
No example.
Differences:
New to FreeBasic.
Syntax: csign (unsigned number)
Type: function
Converts an unsigned number to a signed number, in the same sized data type.
Only useful to force signed behaviour of division or multiplication (including
with shl and shr).
This is the opposite of cunsg.
Differences:
New to FreeBasic.
Type: function
Converts any number to a single-precision number.
Type: function
Category: Console
Returns the current line position (row) of the cursor.
The name can be explained by csr-lin (csr for cursor, lin for line).
Syntax: cunsg (signed number)
Type: function
Converts a signed number to an unsigned number, in the same sized data type.
Only useful to force unsigned behaviour of division or multiplication (including
with shl and shr).
e.g.
This is the opposite of csign.
Differences:
New to FreeBasic.
Syntax: curdir$
Type: function
Category: file
Returns the current directory/folder.
e.g.
See also open, dir$,
mkdir, rmdir.
Differences:
New to FreeBasic.
Syntax: CVD(8-byte-string)
Type: function
Converts an 8-byte-string created with MKD$ back to a double-precision number.
Syntax: CVI(2-byte-string)
Type: function
Converts a 2-byte-string created with MKI$ back to an integer.
Syntax: CVL(4-byte-string)
Type: function
Converts a 4-byte-string created with MKL$ back to a
long integer.
Syntax: CVS(4-byte-string)
Type: function
Converts a 4-byte-string created with MKS$ back to a single-precision number.