error C2664: “void ATL::CStringT<BaseType,StringTraits>::Format(const wchar_t *,...)”: 不能将参数 1 从“const char [12]”转换为“const wchar_t *”

解答:

你用的是VC2005或者更高的版本吧?
VC2005及更高版本默认使用Unicode字符集,CString里存的是宽字符,也就是wchar_t,而不再是char。你可以这么写:
strDate.Format(_T("%4d-%2d-%2d"),st.wYear,st.wMonth,st.wDay);
strTime.Format(_T("%4d:%2d:%2d"),st.wHour,st.wMinute,st.wSecond);
以后写程序的时候,定义字符串变量,不要用char*,而用TCHAR*。所有字符串常量,不要直接用"",而要用_T("")。举个例子:
TCHAR* str = _T( "Hello, World" );
MessageBox( _T( "Hello" )); 
当然,我上面说的是在MFC里面。写控制台程序的话,就不用了。

http://zhidao.baidu.com/link?url=Uj5v8UfCus86IRJMI1-iKkYhklPEGZXTxP5wFW6Jf0aMNfdjFlfK1LvuDeCbotjo9uMPMdn8H6scg6tzmHtmrq

VC2010 CString.Format使用报错 error C2664的更多相关文章

  1. RegDBGetKeyValueEx函数使用报错error 1 numeric value required

    参考:http://evely.blog.51cto.com/1089422/1400965 RegDBGetKeyValueEx函数:  InstallSheild Script Code  123 ...

  2. MySQL数据库使用报错ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

    今天MySQL数据库,在使用的过程中一直报错ERROR 1820 (HY000): You must reset your password using ALTER USER statement be ...

  3. centos安装epel源后,使用报错(Error: Cannot retrieve repository metadata (repomd.xml) for repository: epel. Please verify its path and try again)

    报错如下: Error: Cannot retrieve repository metadata (repomd.xml) for repository: epel. Please verify it ...

  4. pyteeseract使用报错Error: one input ui-file must be specified解决

    Python在图像识别有天然的优势,今天使用pytesseract模块时遇到一个报错:“Error: one input ui-file must be specified”. 环境:windows ...

  5. uiautomatorviewer真机使用报错Error obtaining UI hierarchy

    Mac OS+Android真机 8.0在使用uiautomatorviewer获取界面时报Error obtaining UI hierarchy Reason: Error while obtai ...

  6. adb驱动安装和使用报错笔记

    adb驱动安装 adb驱动下载地址:https://adb.clockworkmod.com/ 安装时候选择一个容易记住的路径,这个很重要,因为adb驱动没有自动配置环境变量,所以实验时候将adb安装 ...

  7. yum源使用报错

    CentOS系统yum源使用报错:Error: Cannot retrieve repository metadata (repomd.xml) for repository: rpmforge. 服 ...

  8. .net core中Grpc使用报错:The remote certificate is invalid according to the validation procedure.

    因为Grpc采用HTTP/2作为通信协议,默认采用LTS/SSL加密方式传输,比如使用.net core启动一个服务端(被调用方)时: public static IHostBuilder Creat ...

  9. animate is not a function(zepto 使用报错)[转]

    animate is not a function(zepto 使用报错) 1.为什么使用zepto写animate报错? 因为zepto默认构建包含: Core, Ajax, Event, Form ...

随机推荐

  1. PHP curl_errno函数

    curl_errno — 返回最后一次的错误号 说明 int curl_errno ( resource $ch ) 返回最后一次cURL操作的错误号. 参数 ch 由 curl_init() 返回的 ...

  2. 【HDOJ6583】Typewriter(SAM,DP)

    题意:给定一个由小写字母组成的字符串,每次可以花费p在串后加上任意一个字母,花费q在串后复制一个当前串的子串,问生成字符串的最小花费 n<=2e5,1<=p,q<2^31 思路: S ...

  3. vue开发微信公众号--开发准备

    由于工作项目的原因,需要使用vue开发微信公众号,但是这种微信公众号更多是将APP套了一个微信的壳子,除了前面的授权和微信有关系以外,其他的都和微信没多大的关系了,特此记录 开发流程 首先需要在电脑上 ...

  4. BZOJ 4399: 魔法少女LJJ(线段树)

    传送门 解题思路 出题人真会玩..操作\(2\)线段树合并,然后每棵线段树维护元素个数和.对于\(6\)这个询问,因为乘积太大,所以要用对数.时间复杂度\(O(nlogn)\) 代码 #include ...

  5. 建站手册-浏览器信息:Mozilla Firefox 浏览器

    ylbtech-建站手册-浏览器信息:Mozilla Firefox 浏览器 1.返回顶部 1. http://www.w3school.com.cn/browsers/browsers_firefo ...

  6. Php安装时出现的问题处理

    问题从这里开始,我们一步一步说明: cd /usr/local/src/ tar zxvf php-5.5.6.tar.gz cd php-5.5.6 ./configure \ //执行当前目录下软 ...

  7. C# 获取微信小程序access_token

    /// <summary> /// 获取access_token /// </summary> /// <returns></returns> publ ...

  8. mysql 查看数据库最大连接数

    show variables like '%max_connections%'; navicat 切换到命令行: navicat查看建表语句: 选中表,右键,对象信息,选择DDL

  9. [LeetCode] 196.删除重复的电子邮箱

    编写一个 SQL 查询,来删除 Person 表中所有重复的电子邮箱,重复的邮箱里只保留 Id 最小 的那个. +----+------------------+ | Id | Email | +-- ...

  10. php Connection timed out after 30000 milliseconds

    function HttpRequest($url, $params, $method = 'GET', $header = array(), $bEncode = true){ $opts = ar ...