博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
CString GetBuffer() 与releasebuffer()的使用
阅读量:4109 次
发布时间:2019-05-25

本文共 589 字,大约阅读时间需要 1 分钟。

CString GetBuffer() 与releasebuffer()的使用
 
getbuffer是为了让你使用CString类中,保存字符串缓冲区的那块指针. 至于releasebuffer,在MSDN中有这样一句话.
If you use the pointer returned by GetBuffer to change the string contents, you must call ReleaseBuffer before using any other CString member functions.
在对GetBuffer返回的指针使用之后需要调用ReleaseBuffer,这样才能使用其他Cstring的operations。否则会发生错误. 
GetBuffer可以获得一个字符数组让你能够方便的对其进行操作,调用GetBuffer以后必须调用ReleaseBuffer释放,否则不能对该CString对象进行操作譬如 CString str = "abcd"
char * lpBuf = str.GetBuffer(0); lpBuf[1] = 'e';
int nLen = str.GetLength(); // 出错,ReleaseBuffer前不能进行类似的操作 str.ReleaseBuffer(); // 此时str="aecd

转载地址:http://aqosi.baihongyu.com/

你可能感兴趣的文章
Scala之flatMap操作
查看>>
Scala之wordCount
查看>>
SparkStreaming之socketTextStream遇到的一些小问题
查看>>
Linux:Pycharm中使用Git
查看>>
gogs的坑:fatal: Could not read from remote repository.
查看>>
Git:Git分支概念、Pycharm中使用使用分支
查看>>
Python:线程同步,Barrier屏障
查看>>
Python:信号量semaphore
查看>>
Python:多进程multiprocessing,多进程和多线程的应用
查看>>
Python:concurrent异步并行任务编程模块、 线程池、进程池、上下文管理
查看>>
JSONArray
查看>>
HTTP 请求中的Header 参数
查看>>
PostgreSQL远程连接,发生的SSL错误
查看>>
PostgreSQL 创建用户
查看>>
mysql 定时任务
查看>>
浅谈sql中的in与not in,exists与not exists的区别以及性能分析
查看>>
Tomcat注册为Windows服务
查看>>
pg_stat_statements windows 安装
查看>>
启用mqtt插件
查看>>
行转列
查看>>