Re: [問題] fopen回傳null該怎麼辦

看板C_and_CPP (C/C++)作者 (CA)時間16年前 (2009/07/12 03:01), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串2/3 (看更多)
※ 引述《QQ29 (我愛阿蓉)》之銘言: try this: #include <stdio.h> #include <string.h> int main() { FILE * fout = NULL; int err = fopen_s( &fout, "C:\\test.bin", "wb" ); if( fout ) { fprintf( stderr, "y\n" ); fclose( fout ); } else { perror( strerror( err ) ); } return 0; } ==== 如果 Visual C++ 跟你靠北 fopen 不安全 有時候聽它的話也不錯 MinGW 就沒辦法了 -- 自High筆記(半荒廢) http://legnaleurc.blogspot.com/ -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 211.74.131.25
文章代碼(AID): #1AME5myg (C_and_CPP)
文章代碼(AID): #1AME5myg (C_and_CPP)