CB Code Samples
This illustrative code shows the functionality of the CB language and can be used to speed up the development of your applications.
You can find these files in the Examples folder contained in the CB runtime distributions (ZIP file).
- APPEND.BAS Shows how to append data to file.
- BINARY.BAS Shows how to read from and write to a binary file.
- BUGSZAPP.BAS Tests more CB functionality to discovery bugs.
- CALJD.BAS This code appeared in astronomical computing, sky & telescope, may, 1984.
- CBVERS.BAS Shows CB version.
- CLOSEBTN.BAS Shows how enable and disable the close button.
- COLORS.BAS Shows how set the console text attribute.
- COMMAND.BAS Shows the command line use.
- COMPRES1.BAS Shows how compress and uncompress with the ZLIB compression library.
- COMPRES2.BAS Shows how compress and uncompress with the ZLIB compression library.
- CONEXE.BAS Shows how execute command inside the command prompt window (console).
- CONSARE.BAS Shows how save and restore the command prompt window (console) State.
- CONSFONT.BAS Shows how to set the command prompt window (console) font.
- COUNTER.BAS Shows how to use the console QSNAP% function.
- CRC32.BAS Shows how to calculate the Cyclic Redundancy Check 32.
- CRYPTO.BAS Shows how to simple encrypt string.
- CTRL.BAS Shows how to enable and disble the Control Break.
- CURRENT.BAS Shows how handle folders stuff.
- CURSTATE.BAS Shows how set cursor appearance.
- DBF.BAS Shows how read data from DBF files.
- DIMARRAY.BAS Shows how size arrays.
- DISKFREE.BAS Shows how get the disk spaces.
- DISKINFO.BAS Shows how retrive the disk geometry.
- DOWNLOAD.BAS Shows how use sockets to download file.
- ELAPSED.BAS Shows how use DateTime functions.
- ENC.BAS Shows how enclose a string inside a double quote.
- ERAEOX.BAS Shows how erase portion of the screen.
- EXAMPLE.BAS The Minnow Bear Computers classic example.
- EXEPATH.BAS Shows how get the executable path.
- FILEAPI.BAS Shows how use the OS API for manipulate file.
- FILENAME.BAS Shows how use the OpenFile dialog.
- FILES.BAS Shows how open 512 files concurrently.
- FMATCH.BAS Shows how use the FMATCH function.
- FONT.BAS Shows how create printer fonts.
- FONT2.BAS Shows how create printer fonts.
- GETFDT.BAS Shows retrive the file date and time.
- GRAP1.BAS Shows the use of graphic functions in CB.
- GRAP2.BAS Shows the use of graphic functions in CB.
- GRAP3.BAS Shows the use of graphic functions in CB.
- GRAP4.BAS Shows the use of graphic functions in CB.
- GRAP5.BAS Shows the use of graphic functions in CB.
- HELLO.BAS The classic hello world program.
- HIDESHOW.BAS Show hot to hide and show the console window.
- INKEY.BAS Shows how read input from keyboard.
- INPUT.BAS Shows how read input from keyboard.
- ISKEYS.BAS Shows how detect when specials keys are pressed.
- ISRUN.BAS Shows how detect if a program is running.
- ISTS.BAS Shows how detect if program is running on terminal server.
- JULIAN.BAS Shows how perform date calculation on Julian calendar.
- KBTEST.BAS Shows how to read keyboard scan code.
- KEYLOCK.BAS Shows how get and set NUMLOCK, CAPITAL and SCROLL lock key.
- KILL.BAS Shows how kill a process.
- LPRINT.BAS Shows the LPRINTER and CONSOLE commands use.
- MAKEDW.BAS Shows how make a double word (DWORD) from two WORD.
- MBTRONF.BAS Shows how use the MBTRON and MBTROFF to print line of current line begin executed.
- MD5.BAS Shows how work with MD5 hash.
- MINMAX.BAS Shows the use of Math MIN% and MAX% functions,
- NEWS.BAS Shows a typical user function structure.
- NOW.BAS Shows the use of DateTime NOW$ function.
- ODDEVEN.BAS Shows the use of Math IsOdd% and IsEven% functions.
- OS.BAS Shows the use of Process Is64BitOS%, GetOSVersion% and Im64BitExe% functions.
- PAD.BAS Shows the use of String ENC$ and LPAD$ functions.
- PEEKPOKE.BAS Shows the use of PEEK, POKE and pointers.
- PRINT.BAS Shows how build a print process.
- PRINTER.BAS Shows how switch from console to printer and return back.
- PRTUSNG.BAS Shows the PRINT USING statement.
- REPLACE.BAS Shows the use of String Replace$ function.
- REDIM.BAS Shows how to erase and re-dim arrays.
- RESDOUDE.BAS Shows how to resize, decrease only, one-dimensional and two-dimensional arrays of doubles.
- RESDOUIN.BAS Shows how to resize, increase only, one-dimensional and two-dimensional arrays of doubles.
- RESINTDE.BAS Shows how to resize, decrease only, one-dimensional and two-dimensional arrays of integers.
- RESINTIN.BAS Shows how to resize, increase only, one-dimensional and two-dimensional arrays of integers.
- RESIZE1.BAS Shows how to resize, increase only, one-dimensional arrays.
- RESIZE2.BAS Shows how to resize, increase and decrease, arrays.
- RESIZE3.BAS Shows how to resize a mono and bi-dimensional arrays.
- RESIZEC.BAS Showsresize the console window.
- RESSTRDE.BAS Shows how to resize, decrease only, one-dimensional and two-dimensional arrays of strings.
- RESSTRIN.BAS Shows how to resize, increase only, one-dimensional and two-dimensional arrays of strings.
- RESTFUL.BAS Shows how set the verbose mode within RESTFUL calls.
- REVSTR.BAS Shows how reverse a string.
- RUN.BAS Shows how run another process wit CB.
- RNDSTR.BAS Shows how create random string.
- SAVRST.BAS Shows how save the console screen inside a string and then restore it.
- SAVRSTXL.BAS Shows how manipulate the console windows then save and restore the window screen.
- SETCONS1.BAS Shows how set and get both console buffer and console window size.
- SETCONS2.BAS Shows how get console handles and set the console screen mode.
- SHA256.BAS Shows how work with SHA256 hash.
- SHELLEXC.BAS Shows the use of MessageBox% and ShellExecute% functions.
- SIZE.BAS Shows the use of LSIZE and SIZE functions.
- SIZEOF.BAS Shows the use of SizeOf% function,
- SLEEP.BAS Shows the use of Sleep% function.
- SORTING.BAS Shows how sort one-dimensional arrays.
- SORTTAG.BAS Shows how sort one-dimensional tagged arrays.
- SPACE.BAS Shows the use of String SPACE$ function.
- SQLITE1.BAS Shows the use of SQLite module.
- SQLITE2.BAS Shows the use of SQLite module.
- SQLITE3.BAS Shows the use of SQLite module.
- STREXCAS.BAS Shows how exchange the case of string chars.
- STRIP.BAS Shows the use of String trims (LTRIM$, TRIM$ and RTRIM$) functions.
- SYSMENU.BAS Shows the disable the console window system menu.
- TESTST.BAS Shows the use of SortTagged% function with a very heavy load.
- TOGFULSC.BAS Shows the how toggle the console full screen.
- TRIM.BAS Shows the use of String trims (LTRIM$, TRIM$ and RTRIM$) functions.
- UUID.BAS Shows the use of Crypto UUID$ function, a universally unique identifier generator.
- VARPTR1.BAS Shows of use memory pointers.
- VARPTR2.BAS Shows of use memory pointers, example taken from the Minnow Bear Computers user manual.
- WHOIS.BAS Shows how use Socket functions to perform whois domain enquiry.
- WINPOS.BAS Shows how move the cursor inside a console window.
- XOR.BAS Show me how to perform XOR encryption between two strings.
Programs witten with CB
Here instead are the sources files of applications written in CB.
- CBTO_CB.BAS Changes a BASIC source to use functions without namespaces, for example from CB.Crypto.CRC32% to CRC32%.