MAINSAIL Language Manual, Section 32.86

previous   next   top   contents   index   framed top   this page unframed


32.86. $cvFieldToString

Figure 32–89. $cvFieldToString
STRING
<
macro>     $cvFieldToString
                        (<
POINTER or ADDRESSa;
                         <
field namefld;
                         
OPTIONAL POINTER($areaarea);

$cvFieldToString is useful for converting a C string to a MAINSAIL STRING.

$cvFieldToString forms an inplace string using:

$cvFieldToStringInPlace(a,fld)

then, if the result is not the empty STRING, copies the STRING text into area (which defaults to $defaultArea) and returns a STRING descriptor for the copied text.

An example of the use of $copyStringToField, $cvFieldToStringInPlace, and $cvFieldToString:

$ALIGN CLASS c ($CHAR $INPLACEARRAY(0 TO 9) cAry);
ADDRESS(ca;
STRING s;

s := "Hello World";
$copyStringToField(s,a,cAry);
    # 
s is truncated to 9 chars + NUL

$cvFieldToStringInPlace(a,cAry) = "Hello Wor", which directly references the characters in the field cAry.

$cvFieldToString(a,cAry) is also "Hello Wor", but the referenced characters are in a STRING space for $defaultArea.


previous   next   top   contents   index   framed top   this page unframed

MAINSAIL Language Manual, Section 32.86