[問題] 不曉得為什麼會變空字串.
開發平台(Platform): (Ex: VC++, GCC, Linux, ...)
cocos2d-x 2.2.3 by VC++ 2012
額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)
libiconv
問題(Question):
刪掉看似無用的code後發現有問題
餵入的資料(Input):
"D:\testConvert\新增資料夾\testSprite.png"
預期的正確結果(Expected Output):
在cocos2d內顯示中文路徑
錯誤結果(Wrong Output):
空字串
程式碼(Code):(請善用置底文網頁, 記得排版)
http://codepad.org/T3p9lBjk
補充說明(Supplement):
這是一個使用iconv轉換編碼的fuction.
我整理code時將
char* pBuff = outbuf; 刪掉(我以為這排不需要.)
並將
str = pBuff;
改成
str = outbuf;
可是發現我得到的str會變成空字串. 為什麼會這樣呢?
還有 本來是 free(outbuf); 但run會出錯.
之後改成 free(pBuff);才可以跑.
有人知道這個pBuff做了什麼嗎?
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 61.224.50.11
※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1468131481.A.853.html
推
07/10 15:26, , 1F
07/10 15:26, 1F
→
07/10 15:27, , 2F
07/10 15:27, 2F
→
07/10 15:28, , 3F
07/10 15:28, 3F
→
07/10 15:36, , 4F
07/10 15:36, 4F
推
07/10 16:22, , 5F
07/10 16:22, 5F
→
07/10 16:22, , 6F
07/10 16:22, 6F
→
07/10 19:11, , 7F
07/10 19:11, 7F
→
07/10 19:12, , 8F
07/10 19:12, 8F
→
07/10 19:14, , 9F
07/10 19:14, 9F
→
07/10 19:20, , 10F
07/10 19:20, 10F
→
07/10 19:58, , 11F
07/10 19:58, 11F
→
07/10 19:59, , 12F
07/10 19:59, 12F