contents   index   previous   next



BStrings

 

In Fortran BStrings are always represented by long-integer handles. The content of the handle (which is a pointer to the BString) must be stored in a four-byte integer variable. Null or unallocated BStrings have null handles. However, an empty BString may also be represented by a handle to a zero-length string. Except to test for empty or null BStrings, and to provide appropriate variables to store handles, f90VB users do not need to concern themselves with the content of these handles. For those of you with inquiring minds, the handle contains a pointer to the memory location of the first character in the BString.

 

As is the case with Fortran OLE strings, BStrings must be handled through the functions and subroutines provided in f90VB. To create a BString, you first declare a variable to hold the BString handle:

 

integer(BSTRHNDL_KIND)::BstrHndl

 

Then you initialize the BString using any of the procedures available in f90VB. For example:

 

BStrHndl=BStrAlloc('My String')

 

Function BStrAlloc allocates a new BString, sets its content to 'My String', and returns a handle to the new BString, which is then stored in variable BstrHndl. To change the content of this BString you may use any of the other f90VB procedures. For example:

 

call StrCopy('This is a new string',BStrHndl)

 

This deallocates the older BString (releasing the memory it uses), allocates a new BString initialized to 'This is a new string', and returns its handle in BStrHndl.