This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Knowledge Base
- :
- String Passed from DotNetCoCreateObject Results in Large Number of Nulls
Subscribe
- Mark as New
- Mark as Read
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
String Passed from DotNetCoCreateObject Results in Large Number of Nulls
String Passed from DotNetCoCreateObject Results in Large Number of Nulls
Summary
When using DotNetCoCreateObject, string values passed are padded by a large number of nulls.Synopsis
Strings passed using DotNetCoCreateObject results in a large number (up to a buffer of 1024 characters) of nulls.Discussion
The InstallScript engine stores the strings as BSTRs and uses them directly when calling COM methods (either a COM object or a .NET assembly that was loaded with the DotNetCoCreateObject function), as the data is language independent. As BSTRs can contain any number of nulls, the BSTRs will retain them. In situations where a large number of nulls follow a string, the empty values are stored as nulls.The TrimEnd method can be added to the .NET code to remove the excess nulls from the string value.
FilePath = <FilePath>.TrimEnd('\0');
Additional Information
Additional information on the TrimEnd Method can be found here.
No ratings