K
Kobu
Do the "larger" input functions like scanf, gets, fgets use fgetc to
take input or an operating system call function like read() (I know it
could be any "way", but I'm trying to find out how it's best to "think
of it")?
I've seen some explain it as if they call fgetc internally, then I've
seen some people explain it as if they call some lower level OS system
call like read(). I've even seen some older posts talk about a input
functions interacting directly with drivers (tty comes up a lot).
I've been searching through the deja/google archives and there is a
mixture of "ways of thinking how larger input functions operate." This
is important to figure out little nook and crany issues like the
eof/error post recently that made me more confused than I've ever been
before about input. This is a sticking point in my journey to
understand these topics on my own- so pls try not to give me RTFM
answers . I also understand many things I'm talking about are not
part of the C standard, but they are interfaces to the C standard and
many C gurus have brought these topics up in previous posts because I
think it helps understand these standard input functions.
Side note: So far this is how I picture the things in my head.
scanf/gets
|
|
\ /
fgetc
|
|
\ /
read() (system call)
|
|
\ /
driver (like tty)
take input or an operating system call function like read() (I know it
could be any "way", but I'm trying to find out how it's best to "think
of it")?
I've seen some explain it as if they call fgetc internally, then I've
seen some people explain it as if they call some lower level OS system
call like read(). I've even seen some older posts talk about a input
functions interacting directly with drivers (tty comes up a lot).
I've been searching through the deja/google archives and there is a
mixture of "ways of thinking how larger input functions operate." This
is important to figure out little nook and crany issues like the
eof/error post recently that made me more confused than I've ever been
before about input. This is a sticking point in my journey to
understand these topics on my own- so pls try not to give me RTFM
answers . I also understand many things I'm talking about are not
part of the C standard, but they are interfaces to the C standard and
many C gurus have brought these topics up in previous posts because I
think it helps understand these standard input functions.
Side note: So far this is how I picture the things in my head.
scanf/gets
|
|
\ /
fgetc
|
|
\ /
read() (system call)
|
|
\ /
driver (like tty)