How to remove a file in C program?

后端 未结 4 1206
礼貌的吻别
礼貌的吻别 2020-12-04 02:30

How do I close a file and remove it?

I have the following code:

FILE *filePtr = fopen(\"fileName\", \"w\");
...

Now I want to close

4条回答
  •  醉梦人生
    2020-12-04 03:11

    You do not need to fopen a file to remove it. But, in linux, if you remove an fopened file, it will be deleted only after closing it. You can still read/write to it.

提交回复
热议问题