List of statements and functions ================================ ' built-in statements END terminates program execution STOP the same as above SYSTEM the same as above RANDOMIZE n sets n as a seed for random-number generator CLS clear screen LOCATE x, y moves cursor to row x, column y COLOR fg, bg sets foreground color to fg, background to bg; if bg is omitted, background is not changed KILL file deletes file RENAME file1 TO file2 renames file1 to file2 CHDIR dir change directory to dir MKDIR dir create directory dir RMDIR dir remove directory dir SHELL cmd execute MS-DOS command cmd ' string manipulation ASC(char) returns ASCII code of char CHR(code) returns character with given ASCII code CHR$(code) the same as above LEN(string) returns length of string MID(string, start, count) returns substring of string MID$(string, start, count) the same as above LEFT(string, count) returns count characters from the left LEFT$(string, count) the same as above RIGHT(string, count) returns count characters from the right RIGHT$(string, count) the same as above TRIM(string) removes all leading and trailing spaces TRIM$(string) the same as above LTRIM(string) remove all leading spaces LTRIM$(string) the same as above RTRIM(string) remove all trailing spaces RTRIM$(string) the same as above UCASE(string) converts string to uppercase UCASE$(string) the same as above LCASE(string) converts string to lowercase LCASE$(string) the same as above INSTR(string, substr) returns first occurence of substr in string REPEAT(string, count) returns string repeated count times REPEAT$(string, count) the same as above STRING$(count, code) returns characher with ASCII code repeated count times SPACE(count) returns count spaces SPACE$(count) the same as above ' math IIF(condition, value1, value2) if condition is true, returns value1, else returns value2 ABS(n) absolute value of n SIN(n) sine of n COS(n) cosine of n TAN(n) tangence of n POW(base, n) base power n SQR(n) square root of n CINT(n) rounds n FIX(n) integer part of n FRAC(n) fractional part of n RND random fractional number in range 0..1 RND(n) random integer in range 0..n ROUND(n, d) n rounded up to d-th sign (0 if omitted) SGN(n) returns 1 if n is positive, -1 if negative, 0 if zero VAL(string) converts string to number STR(n) converts n to string STR$(n) the same as above HEX(n) returns hexadecimal representation of n HEX$(n) the same as above OCT(n) returns octal representation of n OCT$(n) the same as above ' keyboard I/O INSTAT True if key is pressed, False if not INKEY$ returns the key pressed; extended keys are returned as 2-character strings - first byte is CHR(0), the second is a key itself INKEY returns two-byte code of key pressed; the save as above, but returns WORD rather then string ' misc DIR$(pattern) returns the first file matching the pattern or empty string if no such files DIR$ returns the next file matching the pattern defined with first DIR$ call or empty string if no such files DIR(pattern) returns the BFileInfo structure representing the first file matching the pattern; structure has Name, Size and Attributes fields DIR returns the BFileInfo structure representing the next file matching the pattern defined with DIR CURDIR name of current directory EXIST(file) True if file exists, False if not ENVIRON(var) alue of environment variable var DATE current date DATE$ the same as above TIMER number of seconds elapsed since Windows started; not since midnight! LO(word) low-order byte of word LO(long) low-order word of long HI(word) high-order byte of word HI(long) hight-order word of long Stream-based I/O ================ Class: BStream Base class: none Constructors: BStream Properties: Position AS LONG current position in stream, counting from beginning Size AS LONG size of stream Methods: Seek(offset, so) AS LONG changes current position to offset relative to beginning of stream, current position or end of stream, depending on value so argument - valid values are soFromBeginning, soFromCurrent and soFromEnd EOF AS BOOLEAN returns True if end of stream is reached ReadData(buf AS POINTER, len AS LONG) reads len bytes from stream into buf Read(n) reads data from stream and puts it into n; amount of data depends on type of n Read reads INTEGER from stream and returns it Read% reads SHORT from stream and returns it Read& reads LONG from stream and returns it Read! reads SINGLE from stream and returns it Read# reads DOUBLE from stream and returns it Read$ reads STRING from stream and returns it ReadLine reads a line of text from stream and returns it WriteData(buf AS POINTER, len AS LONG) writes len bytes from buf into stream Write(n) writes n to stream; amount of data written depends on type of n WriteLine(s) writes s as a line of text to stream Class: BFile Base class: BStream Constructors: BFile BFile(filename AS STRING, mode AS STRING) opens file filename in given mode; mode can be fmOpenRead, fmOpenReadWrite, fmOpenCreateWrite, fmOpenCreateReadWrite (fmCreate); if mode is omitted, then fmOpenReadWrite is assumed Methods: Open(filename AS STRING, mode AS STRING) see constructor description Close close the file Functions available in console programs only ============================================ COMMAND(n) returns command-line argument n; if n is 0, then name of executable is returned COMMAND$(n) the same as above COMMANDS return total number of command-line arguments