0

これは私のコードです:

outfile = fopen(outname, "w");//outname="/home/user/dir/file"
if (!outfile) {
printf("There was a problem opening %s for writing\n", outname);
}
else {
 /* write to the file, */
 }

実行時の表示: 書き込み用に /home/user/dir/file を開くときに問題が発生しました このエラーについて何か考えがあるかどうか尋ねてください ありがとうございます。

4

1 に答える 1

5

perror()エラーのより良い説明を試みてください。

if (!outfile) {
    /* printf("There was a problem opening %s for writing\n", outname); */
    perror(outname);
}
于 2012-09-19T21:45:31.043 に答える