-
turns buffering back on?
hi guys
I have a this code below:
Code:
#include <stdio.h>
#include <ctype.h>
int main()
{
int c;
while (( c=getchar()) !=EOP){
if ( c== 'z' )
c = 'a';
els if (islower(c))
c++;
putchar(c)
}
}
and I have a question that is asking me to
"""The text includes code to turn off disk buffering for a file descriptor. Write a function thatturns buffering back on"""
I dont get it what command do I need to put? and isnt the buffer already on? and what do I do if I have to make it changes the tty mode itself?
thanks
-
Your code has multiple typos. Always copy and paste working code. If you don't make a reasonable effort, why should we?
Your question is not well-worded. If "the text includes code to turn off disk buffering for a file descriptor" and your task is to "write a function that turns buffering back on" then presumably you should start with the given code and modify it to turn buffering back on.
Yes, disk buffering should already be on.
What does the tty mode have to do with it? The quoted text seems to deal with disk buffering, not terminal I/O.
-
I don't know where you got it, but that code has absolutely zero to do with turning on/off buffering for a file descriptor. it doesn't mention files or descriptors at all, and if you don't realize that simply from looking at it, you need to go back and spend some more time learning c/linux programming. I've never done anything like what you're talking about, but I suspect it would involve calls to ioctl or fcntl, so I'd suggest looking up those functions.