Release 10.1A: OpenEdge Development:
Progress 4GL Reference

> ## PUT-STRING statement

> Stores the null-terminated value of a CHARACTER or LONGCHAR expression at the specified memory location. If `numbytes` is specified, PUT-STRING will copy the requested number of bytes from the variable, regardless of whether there are embedded nulls. In this case PUT-STRING will not put a terminating null into the MEMPTR unless the last byte copied happens to be a null.

> #### Syntax

>     PUT-STRING ( destination , position , [ numbytes ] ) = expression

> ``destination``

> A variable of type RAW or MEMPTR. If `destination` is the Unknown value (`?`), it remains the Unknown value (`?`). If `destination` is a MEMPTR and its region is not allocated (by a SET-SIZE statement or by a Windows dynamic link library (DLL) or UNIX shared library routine), Progress generates a run-time error.

> ``position``

> An INTEGER value greater than 0 that indicates the byte position where Progress stores `expression`. If `position` is less than 1, Progress generates a run-time error.

> For a RAW `destination`, if`position` is greater than the length of `destination`, Progress increases the length of `destination` to `position` plus the remaining bytes needed to store `expression`. The gap between the original `destination` length and `position` is padded with null bytes.

> For a MEMPTR `destination`, if `position` is greater than the length of `destination` or does not leave sufficient room to store `expression`, Progress generates a run-time error.

> ``numbytes``

> An integer value greater than 0 that indicates how many bytes to copy from `expression.` If `position` plus `numbytes` is greater than the length of `destination`, Progress generates a runtime error.

> ``expression``

> An expression (a constant, field name, variable name, or expression) whose value is a CHARACTER or LONGCHAR. Progress converts a LONGCHAR value to `-cpinternal` before it stores the value.

> Example

> For examples of how to use the PUT-STRING statement, see the PUT-BYTE statement reference entry.

> #### Note

> For more information on accessing DLL and UNIX shared library routines from Progress, see OpenEdge Development: Programming Interfaces .

> #### See also

> GET-STRING function, LENGTH function, LENGTH statement, RAW function, RAW statement, SET-SIZE statement

Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095