[問題] 符號"內再度使用"的問題

看板C_and_CPP (C/C++)作者 (密碼呢)時間16年前 (2009/03/13 12:39), 編輯推噓3(301)
留言4則, 4人參與, 最新討論串1/1
我目前是要用到呼叫副函式 寫法是 system("wtf.exe \"test.html");" rel="nofollow">http://aq=f&langpair=en|zh-TW&q=wow&hl=zh-TW\">test.html"); 標紅色是再度用到符號""時外加\ 由於此段是要用於帶入很多的英文字 藍色部份希望是能弄成string 的變數 欲改成 string wow = "Illidan" system("wtf.exe \"test.html");" rel="nofollow">http://aq=f&langpair=en|zh-TW&q=wow&hl=zh-TW\">test.html"); 不知道該如何才能將一段被 "" 括起來的文字中夾雜一個變數 先謝過 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.120.13.200

03/13 12:58, , 1F
把它分成三個字串再組合起來成一個字串
03/13 12:58, 1F

03/13 13:04, , 2F
感謝
03/13 13:04, 2F

03/13 13:35, , 3F
用snprintf
03/13 13:35, 3F

03/13 14:20, , 4F
用 boost::format 或 ostringstream
03/13 14:20, 4F
文章代碼(AID): #19kUDerI (C_and_CPP)
文章代碼(AID): #19kUDerI (C_and_CPP)