考虑到您的程序在文本环境中运行 25 行 x 80 列 (CGA 文本模式 640x200) FreeBASIC 的语法
dim as integer column = 0, row = 0 'Set the variable for store the position
dim as string char = "" ' Set a variable for store the pressed key
cls ' Clear the screen
row = csrlin ' read the actual cursor row and store inside the var row
column = pos ' read the actual cursor column and store inside the var column
do until ( char = chr(27) ) ' make a loop until you press ESC key
char = inkey ' store the pressed key in char variable
if not(char = "") Then ' When you press a key and char store the pressed key then start this routine
if not(char = chr(27)) then ' if pressed a key and not are the ESC or Enter or backspace key
if char = chr(13) then ' when press enter
row = row + 1 ' add a new line if enter are pressed
if row > 23 then row = 23 ' put the stop at row 23
column = 0 ' Put the column at beginning
end if
if char = chr(8) then ' when press backspace
locate row, column
print " "
column = column - 2 ' remove a value from column
if column < 0 then column = 0 ' column cant be lower than 0
end if
if column > 79 then column = 79 ' stop the cursor at 79 column
locate row, column ' move the cursor where
print char ' print the key pressed
column = column + 1 ' add a value to the initial value
end if
locate 24,60 : Print "Row:(" & str(Row) & ") Column:(" & Str(Column) & ")" ' this show where the next cha appair
End if
loop
如果我纠正您的意见,请原谅我,但 BASIC 已经像其他编程语言、VB.NET 和 FreeBASIC 一样发展,您可以在其中开发对象、库并利用用其他语言(如 C 和 C++)编写的库,目前相同的 FreeBASIC是 C 的一个端口,和他一样有同样的潜力,实际上可以在 Linux 和 Windows 上开发图形和文本环境的应用程序,你可以实现库来使用 MySQL 和 Oracle 等数据库,同样的 FreeBASIC 管理多个线程同时运行多个进程。