Results 1 to 6 of 6

Thread: Null terminated string. [Resolved]

  1. #1

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Null terminated string. [Resolved]

    is this a perfectly null terminated string?

    Code:
    TCHAR* g_strFrameStats = _T("Hello\0");
    Last edited by NoteMe; Jun 11th, 2004 at 06:48 PM.

  2. #2

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    Ohhh...yeah it was....sorry, but I found out that it was an other thing causing the error..

    ØØ

  3. #3
    PowerPoster sunburnt's Avatar
    Join Date
    Feb 2001
    Location
    Boulder, Colorado
    Posts
    1,403
    I'm pretty sure that when you use a string literal like that, most compilers will add a null terminator for you.
    Every passing hour brings the Solar System forty-three thousand miles closer to Globular Cluster M13 in Hercules -- and still there are some misfits who insist that there is no such thing as progress.

  4. #4

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    Originally posted by sunburnt
    I'm pretty sure that when you use a string literal like that, most compilers will add a null terminator for you.
    OK...I didn't know that. But I found a DX example that actualy used the same method as I did with the \0 at the end. So it is working now. But thanks anyway.


    ØØ

  5. #5
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    All compilers add the \0, it's required. Why you have in your literal is a double-\0 terminated string. In some places in the API you need those.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  6. #6

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    The doc said I only needed a null terminated string as a parameter. So I guess I don't need a double. I can test it out later on today. I am sitting onthe wrong PC at the moment. And we have to rewrite most of the code anyway, becuase we overlooked a one of D3D internaly critical sections. So we have to rearagne the work of the two threads.

    But I will give you guys a comment on it when I have tested it.

    ØØ

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