Reputation: 1531
stdin
is of type FILE *
,
is there a fd
macro for it?
Or do I need to convert it myself?
Upvotes: 21
Views: 17914
Reputation: 11
#include<unistd.h>
#include<stdlib.h>
int main(){
char ch;
read(STDIN_FILENO,&ch,1);
write(STDOUT_FILENO,&ch,1);
exit(EXIT_SUCCESS);
}
Upvotes: 1
Reputation: 64148
The following are the integer file descriptors for the standard streams:
stdin
stdout
stderr
Upvotes: 2