Results 1 to 6 of 6

Thread: Null-terminating LPTSTR?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Location
    London UK
    Posts
    255

    Null-terminating LPTSTR?

    I need a 32 length null-terminating LPTSTR equivalent in C#, does it exist?
    Not at all related to sheep...

  2. #2
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    Can you pass a 32 element char array?

  3. #3
    Frenzied Member DevGrp's Avatar
    Join Date
    Nov 2001
    Location
    Charlotte, NC
    Posts
    1,256
    Use stringbuilder.
    Dont gain the world and lose your soul

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Location
    London UK
    Posts
    255
    Well the context is, I need to pass something to this parameter:

    LPTSTR lpszReturnString

    I know that in VB 6, this did the trick perfectly:

    VB Code:
    1. Dim sReturn As String * 30

    I just passed sReturn to the function and it filled it and sent it back my way. It worked. Now of course that notation for initializing a string has become obsolete. So I need a replacement, preferably in C# because of it's evident coolness.
    Not at all related to sheep...

  5. #5
    Frenzied Member DevGrp's Avatar
    Join Date
    Nov 2001
    Location
    Charlotte, NC
    Posts
    1,256
    Code:
    StringBuilder sReturn = new StringBuilder();
    You can use the stringbuilder or the string type. .NET will take are of the rest
    Dont gain the world and lose your soul

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Location
    London UK
    Posts
    255
    Well, err, it didn't. Can you give me an example of how you would create the required object?
    Not at all related to sheep...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width