-
Notifications
You must be signed in to change notification settings - Fork 1
Home
Jiowcl edited this page Sep 7, 2019
·
3 revisions
Welcome to the ThinBasic.NET wiki!
Load a ThinBasic script from file.
test_fib.tbasic
file content.
Function TBMain()
Long result = Fibonacci(10)
Msgbox(0, result)
End Function
Function Fibonacci (n As Long) As Long
If (n = 0) Then
Return 0
END IF
If (n = 1) Then
Return 1
Else
Return Fibonacci (n-1) + Fibonacci (n-2)
END IF
End Function
Program.cs
file content.
string scriptPath = @"Sample\test.tbasic";
string scriptBuffer = File.ReadAllText(scriptPath, Encoding.UTF8);
int bufferType = (int)Enums.BufferType.IsScript;
int callingProgram = (int)Enums.CallingProgram.GUI;
int hThinbasic = Thinbasic.Init(0, 0, "thinbasic");
int result = Thinbasic.Run(hThinbasic, scriptBuffer, bufferType, 0, 0, 0, 0, callingProgram, 0);
Thinbasic.Release(0);