What’s the difference between a file descriptor and a file pointer?

A file descriptor is a low-level integer “handle” used to identify an opened file (or socket, or whatever) at the kernel level, in Linux and other Unix-like systems. You pass “naked” file descriptors to actual Unix calls, such as read(), write() and so on. A FILE pointer is a C standard library-level construct, used to … Read more

What’s the difference between a file descriptor and file pointer?

A file descriptor is a low-level integer “handle” used to identify an opened file (or socket, or whatever) at the kernel level, in Linux and other Unix-like systems. You pass “naked” file descriptors to actual Unix calls, such as read(), write() and so on. A FILE pointer is a C standard library-level construct, used to … Read more

Program doesn’t wait for user input with scanf(“%c”,&yn);

printf(“Please enter an output filename: “); scanf(“%s”,&outfilename); When you enter the second string and hit the ENTER key, a string and a character are placed in the input buffer, they are namely: the entered string and the newline character.The string gets consumed by the scanf but the newline remains in the input buffer. Further, scanf(“%c”,&yn); … Read more