fprintfのアサーションチェックで困っており質問しました。
・実行したい処理(mainからsample()を呼び出しています)
void sample(IDR_CARD_RECOG *pRecog){
FILE *fpw = fopen("./sample.txt", "w");
//fopenのアサーションチェック
fprintf(fpw,"会社名:%ls\n", pRecog->company);
fprintf(fpw,"会社名の読み仮名:%ls\n", pRecog->company_kana);
fclose(fpw);
return;
}
上記のexeを叩いたところ、下記のようなエラーが出ました。
Debug Assertion Failed!
Program:(プログラム名).exe
File:f\dd\vctools\crt_bld\self_x86\crt\src\fprintf.c
Line: 55
Expression:(str !=NULL)
For information on how your program can cause an assertion
failure, see the Visual C++ documentation on asserts.
(Press Retry to debug the application)
エラー文よりアサーションチェックが入っていないためと考えたので
アサーションチェックのところにif (fpw == NULL) {exit (1);}を
挿入しデバッグをしました。
すると今度はif文の判定で処理が落ちるようになりました。
これはアサーションチェックを無事通過するにはどのようにすればよいでしょうか?
詳しい方、どうかお願い致します。
(環境はwindows7、visual studio community2015です。)
浅学の私にどうか知恵をお貸し下さい。