CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2009
    Location
    Genova - Italy
    Posts
    38

    [RESOLVED] wcsncpy_s function question

    Hello to everyone.

    I have a simple, little question.
    I am writing the following code:

    Code:
    wchar_t wValore[20] ;
    wchar_t Descriz[] = TEXT("ciao") ;
    wcsncpy_s(wValore, ARRAYSIZE(wValore), Descriz, _TRUNCATE) ;
    wcsncpy_s function put correctly "ciao" string in wValore, then insert the NULL character, and then fill my string wValore with "fe" characters. Does anyone know why it fill the rest of the string with "fe" characters? I can see it with memory window inside VC2008

    Thank you

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: wcsncpy_s function question

    From MSDN (http://msdn.microsoft.com/en-us/libr...43(VS.80).aspx )
    The debug versions of these functions first fill the buffer with 0xFD. To disable this behavior, use _CrtSetDebugFillThreshold
    Victor Nijegorodov

  3. #3
    Join Date
    Jul 2009
    Location
    Genova - Italy
    Posts
    38

    Re: wcsncpy_s function question

    Thank you very much!

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

Featured