Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to close FILE* opened by _wfopen?

Tags:

c++

c

What's the counter part of _wfopen? I found that there is fclose related to fopen, but it seems there is no _wfclose.

like image 440
Thomson Avatar asked Nov 12 '10 08:11

Thomson


People also ask

How do I close files after fopen?

fopen () function creates a new file or opens an existing file. fclose () function closes an opened file.

What if we dont close the file in C++?

In a large program, which runs on long after you have finished reading/writing to the file, not closing it means that your program is still holding the resource. This means that other processes cannot acquire that file until your program terminates (which may not be what you wish for).

What is W mode in C?

w - opens or create a text file in write mode. a - opens a file in append mode. r+ - opens a file in both read and write mode. a+ - opens a file in both read and write mode. w+ - opens a file in both read and write mode.


2 Answers

I would say fclose(), since you don't actually need anything "wide" in order to close it.

like image 141
Ignacio Vazquez-Abrams Avatar answered Sep 20 '22 04:09

Ignacio Vazquez-Abrams


fclose().

Yup, it's that simple. It's just a file handle under the hood.

like image 23
Moo-Juice Avatar answered Sep 19 '22 04:09

Moo-Juice