CString操作後,結果不正確

2021-07-05 19:43:41 字數 551 閱讀 6942

cstring temp;

temp.format(_t("%s"),_t("abcd"));

pathremovefilespec((lptstr)(lpctstr)temp);

temp=temp+_t("efg");

預想的結果是「abcdefg」 但是結果卻是 「abcd」

但是縱觀整個跟帖的都不能找到乙個可靠的解決方法,鬱悶啊。不過無意間看到這個部落格:

裡面大約是對cstring的內部機理進行的講解,而且指出了兩種常見的錯誤,其中他的第二條就很好的說明了我的問題。

lpcstr

處理後的cstring

,類似於對cstring進行了getbuffer處理一樣。咦,這句話就是重點了。於是我修改了下我的**如下:

cstring temp;

temp.format(_t("%s"),_t("abcd"));

pathremovefilespec((lptstr)(lpctstr)temp);

temp.releasebuffer

temp=temp+_t("efg");

MySQL order by 排序結果不正確

新建一張測試表 create table tb1 id bigint 20 not null auto increment,a decimal 19,2 not null,acid bigint 20 not null,prid bigint 20 not null,primary key id k...

C 輸入格式不正確

機房收費系統統計乙個操作員結賬情況時,對充值 退卡 收費進行求和查詢。報錯我的d層沒毛病的 是這樣寫的 sqlhelper.sqlhelper sqlhelper new sqlhelper.sqlhelper sqlparameter sqlparams1 string sql1 select s...

確認方法沒有錯誤,但查詢結果不正確

問題 在除錯某web工程時,發現乙個po.get 沒有執行,debug 除錯,該 屬性為空,但資料表中有值,且沒有任何報錯 解決 1.重新執行單元測試類,發現問題確實存在,查不到值 3.重新檢查,發現是 查詢select xx.的問題,那個屬性字段,沒有在select範圍內 注意 1.po類只是對映...