what do you mean by a null terminated string

Posted on 2006-05-15
Last Modified: 2009-07-29
Hi Experts,

What do you mean by a null terminated string and how do you pass it in VB.NET.
Question by:srivatsavaye
    1 Comment
    LVL 12

    Accepted Solution

    Hello, srivatsavaye,

    A null terminated string is one that ends with an Ascii "Null" character.  (It is used quite a bit in C programming.)  You can add a null in VB.Net by using the Chr function.  E.g.

            Dim NullTermString As String = "ABCD" & Chr(0)

    You would probably be passing this to some unmanaged routine.  In this case, use the <MarshalAs(UnmanagedType.LPStr)> attribute when you declare the parameter to the routine.


    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    Join & Write a Comment

    This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
    If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now