hr=StringCchPrintf(inputCh,TextLen,TEXT("%s"),editbuf);// add 0724执行后inputCh的字符数实际上是不是只有TextLen-1个呢?谢谢

解决方案 »

  1.   

    Parameters
    pszDest 
    [out] Pointer to a buffer that receives the formatted, null-terminated string created from pszFormat and its arguments. 
    cchDest 
    [in] Size of the destination buffer, in characters. 
    This value must be sufficiently large to accommodate the final formatted string plus 1 to account for the terminating null character. 
    The maximum number of characters allowed is STRSAFE_MAX_CCH. 
      

  2.   

    StringCchPrintf always null-terminates a non-zero-length destination buffer.
      

  3.   


    msdn是这么说 但是我用这个函数的时候,buf一定要设得比长度大一位才能完全copy过来不知道为什么