Re: Marshalling strings as fixed length WITHOUT null terminator.

Tech-Archive recommends: Speed Up your PC by fixing your registry

From: Mattias Sjögren (mattias.dont.want.spam_at_mvps.org)
Date: 02/21/05


Date: Mon, 21 Feb 2005 21:08:52 +0100


>How can i make it marshall the strings as "proper" fixed length
>strings, where the full 8 (or 3) characters can be stored without having to
>extend the length of the strings.

Replace the strings with char[] and change the marshaling setting to
ByValArray.

Mattias

-- 
Mattias Sjögren [MVP]  mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.


Relevant Pages

  • Re: Efficient fixed width string substition puzzle
    ... Since strings are immutable, you'll always have to create a new string ... I'd use a StringBuilder or a char[] to reduce the ... Mattias Sjögren [MVP] mattias @ mvps.org ... Please reply only to the newsgroup. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Sets and portability (was) Re: Is ISO Pascal compatible with J&W (original) Pascal ?
    ... strings, the user can control the length by the data they process; ... >> The computer world is more complex than it's ever been (eg Unicode) ... The Pascal `Char' type can be this size (unlike C, ... > Note that ansi->wide conversion is codepage sensitive. ...
    (comp.lang.pascal.misc)
  • Re: socket communication: send & receive doesnt work right
    ... But can I actually send and receive strings? ... I did a test of sending two doubles: ... public void send_doubles(double vals, int len) throws ... char *result; ...
    (microsoft.public.win32.programmer.networks)
  • Re: Efficient strcat implementation.
    ... Programmers using the `strcat' or `wcscat' function (or the ... /* This function concatenates arbitrarily many strings. ... concat (const char *str, ...) ... if (newp == NULL) ...
    (comp.lang.c)
  • Re: Replacing a word in a string
    ... original for large strings with many small replacements. ... * strend and tokend must point to the last char before the terminating nul, ... const char *p, *q; ...
    (comp.lang.c)