- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
!----------------------------------------------------------
! St7APIDemo.f90
!----------------------------------------------------------
! This example demonstrates the Visual Fortran link to
! the Strand7/Straus7 API. The program loads St7API.DLL,
! opens a requested file and then runs the linear static
! solver.
!
! To successfully run this program, the location of
! the dynamic link library "ST7API.DLL" must be added to
! the Windows PATH environment variable.
!
! This program was successully compiled and run using:
! - Intel Visual Fortran 10.0
! - Compaq Visual Fortran 6.6.0
!----------------------------------------------------------
PROGRAM Tyr
! Use the API interface and constants modules
USE St7APICall
USE St7APIConst
IMPLICIT NONE
! Declaration of local variables
INTEGER(4) :: iNode,nNode,nBeam,nPlate,nBrick,nMax,iErr
REAL(8) :: XYZ(3)
LOGICAL :: Loaded
CHARACTER(kMaxStrLen) :: fName,sAuthor,sTitle
! Load the API
CALL LoadSt7API(Loaded)
IF (Loaded) then
WRITE(*,*) "ST7API.DLL loaded successfully."
ELSE
WRITE(*,*) "Cannot load ST7API.DLL."
WRITE(*,*) "Press <Enter>"
READ(*,*)
STOP
ENDIF
! Initialise the API
iErr = St7Init()
IF (iErr == ERR7_NoError) THEN
WRITE(*,*) "API initialisation successful."
ELSE
WRITE(*,*) "Error initialising the API."
WRITE(*,*) "Press <Enter>"
READ(*,*)
STOP
ENDIF
! Open a user-selected ST7 file
WRITE(*,100)
100 Format( "Enter ST7 file name:",\)
READ(*,*) fName
iErr = St7OpenFile(1,"mesh1.st7"C,"b:\\temp"C)
Strand7 is a FEM program from Australia. I now have my large Dutch Bridge models running, and I want to use the Strand7 API to get out the results. The sample program passes the filename as shown with line58, how do I translate variable fname to the C form, not done this in my whole life, I understand the basic theory, but not the actual step. If I just run in file name mesh1.st7, it says file not found.
Thanks
John
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
trim(fname)//char(0) will do it. Fortran 2023 will include an intrinsic that will do this for you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you that worked perfectly. I had tried a couple of suggestions in Fortran Discourse, but they did not seem to want to work.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page