Converting QuickBASIC to True BASIC 6 and InStr function

I have a number of Microsoft QuickBASIC programs that I have written over the past 30 years. The programs also using routines from the “Crescent QuickPak Professional” library. The software does not recognize long filenames (it only knows the old 8.3 DOS format) and the compiler creates 16-bit executables that do not run under 64-bit Windows. I am interested in converting my QuickBASIC code to True BASIC 6. I downloaded the “BASIC to True BASIC Converter” and ran it to convert one of my source code files. It completed showing errors for the QuickPak functions it did not recognize. I replaced those functions with standard QuickBASIC functions and re-ran the converter and it completed with no errors.

One of the functions I use is “InStr” (below is a definition of that function). I downloaded and looked at the “True BASIC 6 Silver Edition Manual” and did not see that function listed. If that function is not supported in “True BASIC 6”, why did not the converter indicate an error for every line of code that includes the “InStr” function? If it is a valid “True BASIC 6” function, on what page of the manual will I find the description? If it is a not a valid “True BASIC 6” function, what “True BASIC 6” code can I use in its place?

The description at the website of the “True BASIC 6 Silver Edition” says it includes 1,400+ pre-written subroutines. Where can I find a list and description of those subroutines?

Thanks to anyone who can help me out.

The InStr function returns the character position of the first occurrence of a string in another string. The syntax for InStr is as follows

InStr ( [Start,] string1, string2 )

where the variables refer to the following:

Variable Description
Start The [optional] character location to begin searching in string1
string1 The character string to be searched
string2 The character string to be searched for

The values returned by the InStr function are as follows:

Value Description
n Refers to the character position of string2 in string1.
0 string2 was not found in string1.
0 string1 is a null string ("").
0 The value for Start is greater than the length of string1.

If string2 is a null string (""), then InStr returns the value of 1 unless a Start argument was specified, in which case it returns a value equal to Start.


Re:Converting QuickBASIC to True BASIC 6 and InStr function

I can't help you there. I never use automatic converters. They usually add libraries on to the original code to supply missing functions and that creates bloated, slow code. I've always had better luck converting by hand. It's not that hard to do and most lines won't need converting at all. It does, however, require a thorough knowledge of both versions of BASIC but so does a converter since you have to go through manually and fix conversion errors anyway.

InStr function

In TrueBASIC, this is replaced by POS


Returns the position of the first character of the first occurance of the entire second string in the first string. If the last parameter (Start) is included, searching will start at that position in the searched string)

POS("This is a string","is") returns 3

POS("This is a string","is",4) returns 6

POSR searches for the LAST occurance of string2 in string1

TrueBASIC also has much more powerful functions for searching strings. See the CPOS and CPOSR functions.

Tom Lake

Thanks for the answer.The

Thanks for the answer.

The “BASIC to True BASIC Converter” should have replaced the InStr function with the POS function or reported all the InStr lines as unknown code errors. Instead, it just copied over the original source code for that function as if it was a valid True BASIC function. I hope they update the converter to fix this.

I will have to carefully test all the converted source code because there may be other functions that are not valid in True BASIC but are also not reported as unknown.

Are there any known issues with the “BASIC to True BASIC Converter” where it does not flag code that is not valid True BASIC code?

INSTR function in Quickbasic

I agree that the converter should recognize INSTR as a non TrueBASIC function. I also agree with Tom L. that the correct conversion is the TrueBASIC POS function.

I will take a look at the source code for the converter - if I can find it - and I will check why it doesn't make the correct substitution.

Big John

Did you ever have time to

Did you ever have time to look to see why it doesn't make the correct substitution?