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

Variant To C String Function
Convert Values Class

Public Function VariantToCString( _
    ByVal vBasicString As Variant _
    ) As String

Convert a value into a C string (a string with a Nil (Chr$(0)) terminating character).
This function is usually used to prepare Visual Basic strings for passing to C language DLLs such as the Windows API functions.
This function should only be used to pass strings to Windows API functions which cannot possibly lengthen the string.

    VariantToCString("Word") = "Word" + Chr$(0)
    VariantToCString(123456) = "123456" + Chr$(0)
    VariantToCString(Null) = Chr$(0)
See also:
    VariantToFixedCString function
Note: The VariantToFixedCString function has a similar purpose, except that it also makes sure that the result string has a specific length.

vBasicString: The value which is to be converted into a C string. Function returns a string containing a single Nil (Chr$(0)) character if vBasicString is Null.

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