本文介绍了将CString与TCHAR指针进行比较的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何比较CString和TCHAR指针。



CSstring sFile1 = _T(d:\\\\);

TCHAR szFile1 = new TCHAR [100];



szFile1 =d:\\gh;



如何比较sFile1和szFile1

解决方案



至少有两个错误:

  • 您正在尝试将数组分配给a单个 TCHAR 变量(编译器错误)。
  • 如果修复了上一个错误,则使用next语句丢弃对动态分配内存的引用(运行时)不良行为:内存泄漏)。



features, at least, two mistakes:

  • You are trying to assigning an array to a single TCHAR variable (compiler error).
  • If you fix the previous error then, with next statement you are discarding the reference to dynamically allocated memory (runtime bad behavior: memory leak).



这篇关于将CString与TCHAR指针进行比较的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-22 22:00
查看更多