zoukankan      html  css  js  c++  java
  • wcscpy_s

    wcscpy_s是对应于wcscpy的安全版本。

    CString cstrVolDesc;
    wchar_t* label = new wchar_t[100];
    ..
    ..
    //wcscpy_s(label, cstrVolDesc.GetLength(), cstrVolDesc.GetString());//error:"Buffer too small"
    wcscpy_s(label, cstrVolDesc.GetLength()+1, cstrVolDesc.GetString());
    ..

    可见,使用wcscpy_s一定要保证目标字符串的大小一定要比源字符串大,而且第二个参数指定的数量至少等于源字符串的大小+1(包括最后的)

  • 相关阅读:
    【leetcode】二叉搜索树的最近公共祖先
    052-12
    052-11
    052-10
    052-9
    052-8
    052-6
    052-5
    052-3
    052-2
  • 原文地址:https://www.cnblogs.com/tupx/p/3434147.html
Copyright © 2011-2022 走看看