E
Eric Johannsen
Hi,
My C# code is calling VB6 code, which expects all (fixed-length) strings to
be padded with spaces. The strings are contained with a struct, something
like this (attributes to simulate fixed-length in C# omitted for brevity):
struct MyStruct
{
int someValue;
string myString;
string anotherString;
}
When I create a new myStruct, it's memory space is initialized with binary
0's (per the C# spec). I would like to find a way to overwrite the
myStruct's entire memory space with spaces ' '.
Also, when I assign a particular string to a structure member like this:
myStruct.myString = "123";
the memory buffer for myString ends up getting null terminated. Is there a
work-around for that?
I have considered using char[] instead of string, but while working with
MyStruct I don't know how large the fixed-string size for any particular
structure member is.
Thanks,
Eric
My C# code is calling VB6 code, which expects all (fixed-length) strings to
be padded with spaces. The strings are contained with a struct, something
like this (attributes to simulate fixed-length in C# omitted for brevity):
struct MyStruct
{
int someValue;
string myString;
string anotherString;
}
When I create a new myStruct, it's memory space is initialized with binary
0's (per the C# spec). I would like to find a way to overwrite the
myStruct's entire memory space with spaces ' '.
Also, when I assign a particular string to a structure member like this:
myStruct.myString = "123";
the memory buffer for myString ends up getting null terminated. Is there a
work-around for that?
I have considered using char[] instead of string, but while working with
MyStruct I don't know how large the fixed-string size for any particular
structure member is.
Thanks,
Eric