格式化字符串中的大S和小s
2004-08-16 13:04
225 查看
// 输出中文
char szA[8];
WCHAR szW[8];
sprintf(szA, "%s", L"和平"); // 乱码,四个字节
sprintf(szA, "%s", "和平"); // 和平
sprintf(szA, "%S", L"和平"); // 零字节
sprintf(szA, "%S", "和平"); // 零字节
swprintf(szW, L"%s", L"和平"); // 和平,四个字节
swprintf(szW, L"%s", "和平"); // 无法输出,四个字节,内容是ANSI码
swprintf(szW, L"%S", L"和平"); // 无法输出,八个字节,内容是Unicode码
swprintf(szW, L"%S", "和平"); // 无法输出,八个字节,内容是ANSI码
wsprintfA(szA, "%s", L"和平"); // 乱码,四个字节
wsprintfA(szA, "%s", "和平"); // 和平
wsprintfA(szA, "%S", L"和平"); // 和平
wsprintfA(szA, "%S", "和平"); // 乱码,两个字节
wsprintfW(szW, L"%s", L"和平"); // 和平,四个字节
wsprintfW(szW, L"%s", "和平"); // 无法输出,四个字节,内容是ANSI码
wsprintfW(szW, L"%S", L"和平"); // 无法输出,六个字节,内容是Unicode码
wsprintfW(szW, L"%S", "和平"); // 和平,八个字节
// 输出英文
char szA[8];
WCHAR szW[8];
sprintf(szA, "%s", L"well"); // w,一个字节
sprintf(szA, "%s", "well"); // well,四个字节
sprintf(szA, "%S", L"well"); // well,四个字节
sprintf(szA, "%S", "well"); // 零字节
swprintf(szW, L"%s", L"well"); // well,八个字节
swprintf(szW, L"%s", "well"); // 乱码,四个字节
swprintf(szW, L"%S", L"well"); // w,两个字节
swprintf(szW, L"%S", "well"); // well,八个字节
wsprintfA(szA, "%s", L"well"); // w,一个字节
wsprintfA(szA, "%s", "well"); // well,四个字节
wsprintfA(szA, "%S", L"well"); // well,四个字节
wsprintfA(szA, "%S", "well"); // 乱码,四个字节
wsprintfW(szW, L"%s", L"well"); // well,八个字节
wsprintfW(szW, L"%s", "well"); // 乱码,四个字节,内容是ANSI码
wsprintfW(szW, L"%S", L"well"); // w,两个字节
wsprintfW(szW, L"%S", "well"); // well,八个字节
char szA[8];
WCHAR szW[8];
sprintf(szA, "%s", L"和平"); // 乱码,四个字节
sprintf(szA, "%s", "和平"); // 和平
sprintf(szA, "%S", L"和平"); // 零字节
sprintf(szA, "%S", "和平"); // 零字节
swprintf(szW, L"%s", L"和平"); // 和平,四个字节
swprintf(szW, L"%s", "和平"); // 无法输出,四个字节,内容是ANSI码
swprintf(szW, L"%S", L"和平"); // 无法输出,八个字节,内容是Unicode码
swprintf(szW, L"%S", "和平"); // 无法输出,八个字节,内容是ANSI码
wsprintfA(szA, "%s", L"和平"); // 乱码,四个字节
wsprintfA(szA, "%s", "和平"); // 和平
wsprintfA(szA, "%S", L"和平"); // 和平
wsprintfA(szA, "%S", "和平"); // 乱码,两个字节
wsprintfW(szW, L"%s", L"和平"); // 和平,四个字节
wsprintfW(szW, L"%s", "和平"); // 无法输出,四个字节,内容是ANSI码
wsprintfW(szW, L"%S", L"和平"); // 无法输出,六个字节,内容是Unicode码
wsprintfW(szW, L"%S", "和平"); // 和平,八个字节
// 输出英文
char szA[8];
WCHAR szW[8];
sprintf(szA, "%s", L"well"); // w,一个字节
sprintf(szA, "%s", "well"); // well,四个字节
sprintf(szA, "%S", L"well"); // well,四个字节
sprintf(szA, "%S", "well"); // 零字节
swprintf(szW, L"%s", L"well"); // well,八个字节
swprintf(szW, L"%s", "well"); // 乱码,四个字节
swprintf(szW, L"%S", L"well"); // w,两个字节
swprintf(szW, L"%S", "well"); // well,八个字节
wsprintfA(szA, "%s", L"well"); // w,一个字节
wsprintfA(szA, "%s", "well"); // well,四个字节
wsprintfA(szA, "%S", L"well"); // well,四个字节
wsprintfA(szA, "%S", "well"); // 乱码,四个字节
wsprintfW(szW, L"%s", L"well"); // well,八个字节
wsprintfW(szW, L"%s", "well"); // 乱码,四个字节,内容是ANSI码
wsprintfW(szW, L"%S", L"well"); // w,两个字节
wsprintfW(szW, L"%S", "well"); // well,八个字节
相关文章推荐
- 关于格式化字符串及其他的反操作……分析
- 金额 格式化转换字符串
- .NET格式化字符串详细说明
- C语言下获取当前时间并格式化成字符串的方法-可用作截图或者录像的文件名
- C# 格式化字符串 String.Format (http://blog.soease.com/andy/)
- Flex中将颜色格式化为字符串的例子
- Help me_格式化字符串问题_AX
- 实现一个简单的字符串格式化方法
- python控制台颜色输出以及字符串格式化输出
- printf 格式化字符串
- 正则表达式:数值及数值型字符串三位一组格式化
- Delphi的System.Str - 将数字格式化为字符串
- 格式化字符串长度,超出部分显示省略号,区分汉字跟字母
- JAVA字符串格式化-String.format()的使用
- Python 字符串 格式化 输出
- 如何使用JS在HTML中自定义字符串格式化
- python3----字符串格式化(format)
- JAVA字符串格式化-String.format()的使用
- java字符串与格式化如何输出
- C# 字符串格式化