On Wed, 2005-01-19 06:53:00 -0000, [EMAIL PROTECTED] <[EMAIL PROTECTED]>
wrote in message <[EMAIL PROTECTED]>:
> Can someone pls let me know the difference b/w file pointers and file
> descriptors?? In what way do they differ intenally?

A file descriptor is an integer value, which is meaningful to the
operating system kernel. It is commonly used via

open()
read()
write()
close()

These functions use simple char buffers and upon read/write, you specify
the number of bytes to read.

File pointers are a libc thing. Internally, they contain a buffer, which
is used to allow eg. for line-buffered access (so you can read a whole
line of textual input without knowing in advance how long it is). File
pointers are handled by the "f" function:

fopen()
fgets()
fputs()
fclose()

However, there are a lot more subtle details behing it... But the short
version of "when shall I use this or that" is: if you handle textual
data, line by line, use the "f" functions. If you use raw binary data,
use the non-"f" functions instead.

MfG, JBG

-- 
Jan-Benedict Glaw       [EMAIL PROTECTED]    . +49-172-7608481             _ O _
"Eine Freie Meinung in  einem Freien Kopf    | Gegen Zensur | Gegen Krieg  _ _ O
 fuer einen Freien Staat voll Freier BÃrger" | im Internet! |   im Irak!   O O 
O
ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TCPA));

Attachment: signature.asc
Description: Digital signature

Reply via email to