Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

open vs fopen

Status
Not open for further replies.

cantubas

Programmer
Jan 8, 2004
45
FR
which are the differences between fopen and open?

i 've not the same result if i use open-read-close or if i use fopen-fread-fclose in order to read on a terminal
 
just subtle differences, one returns a handle, the other a pointer. One has a little more supporting functions, and buffered/non-buffered, file locking etc.

Since this is C++, the stream class object is the one to use.
 
fopen typically calls open, because open is usually a low-level system call, whereas fopen is usually implemented entirely in the C run-time library.
 
in fact what i want to know, it's teh difference between open-read and fopen-fread (some parameters I/O...).
i'ven't got the same result when i read /dev/telnet/xxxx

 
fopen uses open.

You can only fopen 256 files but you can open more than 256 files. If you do 256 opens then try an fopen, the fopen will fail.

The number of files you can fopen is kernel configurable but I don't know of anyone who has tried it and you are warned not to do it as it may have side effects on the rest of the system.
 
The main difference is: fopen() family is the language standard part, but open() isn't...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top