[問題] c++風格的fprintf

看板C_and_CPP作者 (老師說要愛數學)時間9年前發表 (2015/11/21 17:34), 9年前編輯推噓3(301)
留言4則, 4人參與, 最新討論串1/1
開發平台(Platform): (Ex: VC++, GCC, Linux, ...) g++ 額外使用到的函數庫(Library Used): (Ex: OpenGL, ...) 問題(Question): FILE f=popen("gnuplot -persistent","w"); fprintf(f,"plot '-'") fprintf(f,"%f %f",var[1],var[2]); 請問上述寫法有沒有比較C++風格的方式? 比方說 f << var ; 之類的? -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 140.113.56.25 ※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1448127279.A.968.html

11/22 01:55, , 1F
11/22 01:55, 1F
※ 編輯: PhysiAndMath (140.113.56.25), 11/22/2015 02:14:44

11/22 11:43, , 2F
不就是 fstream 嗎
11/22 11:43, 2F

11/22 12:06, , 3F
stringstream + fputs?
11/22 12:06, 3F

11/22 15:06, , 4F
fstream+boost::format ?
11/22 15:06, 4F
文章代碼(AID): #1MKAilbe (C_and_CPP)