Your Browser is not longer supported
Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...
{{viewport.spaceProperty.prod}}
close - Close file and flush buffer (elementary)
&pagelevel(4)&pagelevel
Definition | #include <stdio.h> int close(int fd); close closes a file that was opened by open /open64 or creat /creat64 . Before closing the file, close calls the fflush function, which flushes the buffer. |
Return val. | 0 -1 | close has closed the file with the file descriptor fd. The file descriptor is unknown or no file is open for this file descriptor. In addition, errno is set to EBADF (invalid file descriptor). |
Notes | Upon termination of a program (normal or with exit ), all open files are automatically closed. A maximum of _NFILE files may be open simultaneously per program. _NFILE is defined as 2048 in <stdio.h>. Programs that process more files must therefore temporarily close unused ones. If the file was opened with the standard I/O function fopen or fopen64 , it must be closed with fclose instead of close . |
Example See also | see example under lseek /lseek64 creat, creat64, fclose, fflush, open, open64, exit |