GETSTR@

Platform

x64, Win32

Purpose

To get a string which was stored using ALLOCSTR@.

Syntax

CHARACTER (LEN=*) FUNCTION GETSTR@(PTR)
INTEGER (KIND=7) PTR

Description

This function can be used for strings allocated with the ALLOCSTR@ routine. ALLOCSTR@ and GETSTR@ provide a simple way of storing and retrieving large amounts of character information for which a maximum possible length of each element is known, but where if all trailing spaces were stored the amount of memory required would be excessive. For example, lines of text destined for screen display could be stored in this way (usually a maximum of 80 characters, but often with much trailing space).

Another application of this routine is for C string entities passed to Fortran routines.

Return value

GETSTR@ returns the null-terminated string at address PTR as a Fortran CHARACTER entity, truncating or blank-padding as necessary.

Example

INTEGER (KIND=7)::ALLOCSTR@,PTR
CHARACTER (LEN=80):: GETSTR@
. . .
PTR=ALLOCSTR@(LINE)
. . .
OUTLIN=GETSTR@(PTR)
PRINT '(A)', OUTLIN 

 

 

Basket
Empty
 
Copyright © 1999-2024 Silverfrost Limited