Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

open and fopen function [duplicate]

Tags:

c

Possible Duplicate:
C fopen vs open

What is the difference between open() and fopen() in C language?

like image 494
Pradeep Avatar asked Aug 31 '10 03:08

Pradeep


1 Answers

One is part of the standard c library (fopen) so you can expect it to be present on all hosted c compiler setups. This function returns a FILE* which can be operated on by the functions in <stdio.h>.

The other (open) is a system call/function not specified by the c standard (however, i believe it is part of the POSIX standard) and therefore only guaranteed to exist on select platforms which claim to support it. This returns an int which represents a file, this can be operated on using read/write and other similar functions.

like image 184
Evan Teran Avatar answered Sep 20 '22 20:09

Evan Teran