<-- Previous || Up || Next -->

Variant To Fixed C String Function
Convert Values Class

Public Function VariantToFixedCString( _
      Optional ByVal vBasicString As Variant _
    , Optional ByVal vCStringSize As Variant _
    ) As String

Create a C string of length vCStringSize and copy vBasicString into it.
Normally used to allocate a string with enough space to receive a string value back from Windows API function calls.

    VariantToFixedString("Word", 40) = "Word" + String$(36, 0)
    VariantToFixedString("Word", 4) = "Wor" + Chr$(0)
    VariantToFixedString(123456, 4) = "123" + Chr$(0)
    VariantToFixedString("", 4) = String$(4, 0)
    VariantToFixedString(Null, 4) = String$(4, 0)
See also:
    VariantToCString Function
Note: The VariantToCString function is used to prepare strings to be passed to Windows API functions which do not modify their arguments.

vBasicString: The value which is to be converted into a fixed-length, nil-terminated C string. Function returns a string containing a single Nil (Chr$(0)) character if vBasicString is Null. vBasicString defaults to an empty string if it is missing or Null or cannot be fixed up to a String.

vCStringSize: The size in characters of the fixed-length result string that this function will produce. vCStringSize defaults to 255 if it is missing or Null or cannot be fixed up to a number.

Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.