CanaimaSoft
f90SQL
Search
Contents
f90ADO
Links
f90VB
 
 
 
 

Simple BStrings manipulation (BStrAllocExamples)

This is a simple example illustrating how easily you manipulate BStrings in Fortran using f90VB. In particular you should notice the following points:

  • BStrings can be allocated directly from a Fortran string:

    BStrA = BStrAlloc('Example string')

  • You can allocate Bstrings using other BStrings as the data source:

    BstrB= BStrAlloc(BstrA,7)

  • Subroutine StrCopy lets you easily convert from one string type to other:

    call StrCopy(BstrA, FStr)

And here is the example:

 

 
Program BStrAllocExamples

!Demonstrates the use of function BStrAlloc
!Copyright (C) 1999-2000, Canaima Software, Inc.
!All rights reserved

!load f90VB modules
use f90VBDefs
use f90VBBStrings
implicit none

!declare two Bstrings
integer(BSTRHNDL_KIND):: BStrA, BStrB
character(len=25):: FStr

!Allocate and initialize BStrA
BStrA = BStrAlloc('Example string')

!Allocate and initialize BStrB with the first
!seven characters from BStrA
BstrB= BStrAlloc(BstrA,7)

!Copy BStrA into a Fortran string for printing
call StrCopy(BstrA, FStr)
!Print info about BStrA
print *,'BStrA:', FStr
print *,'BString A Length:',StrLenTrim(BStrA)

!Copy BStrB into a Fortran string for printing
call StrCopy(BstrB, FStr)
!Print info about BStrA
call StrCopy(BstrB, FStr)
print *,'BStrB:', FStr
print *,'BString B Length:',StrLenTrim(BStrB)

!Free string memory
call StrFree(BStrA)
call StrFree(BStrB)

stop
end
Copyright © 1998-2000 Canaima Software
For questions regarding this site, send an e-mail to
webmaster@canaimasoft.com