[問題] MFC struct 寫檔問題

看板C_and_CPP (C/C++)作者 (Deathful)時間14年前 (2011/11/28 22:43), 編輯推噓0(001)
留言1則, 1人參與, 最新討論串1/1
開發平台(Platform): (Ex: VC++, GCC, Linux, ...) VS2005 MFC win32 額外使用到的函數庫(Library Used): (Ex: OpenGL, ...) 問題(Question): 餵入的資料(Input): 預期的正確結果(Expected Output): 錯誤結果(Wrong Output): 程式碼(Code):(請善用置底文網頁, 記得排版) struct data_food food ; CStdioFile file_to_ascii; file_to_ascii.Open( path_to_food , CFile::modeCreate | CFile::modeWrite ) ; file_to_ascii.Write( food , sizeof(struct data_food) ); 補充說明(Supplement): 請問要怎麼把結構(struct data_food food)整包寫到 外部.txt檔??? 使用 file_to_ascii.Write 會有錯誤訊息 無法將參數 1 從 'CServerSocketDlg::data_food' 轉換成 'const void *' -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 114.41.126.242

11/28 22:52, , 1F
整包寫進去看起來就是會爛掉XD 你可以用&food (加個&
11/28 22:52, 1F
文章代碼(AID): #1EqvuGg5 (C_and_CPP)
文章代碼(AID): #1EqvuGg5 (C_and_CPP)