turns buffering back on?

This is a discussion on turns buffering back on? within the Linux Programming forums, part of the Platform Specific Boards category; hi guys I have a this code below: Code: #include <stdio.h> #include <ctype.h> int main() { int c; while (( ...

  1. #1
    Registered User
    Join Date
    Apr 2012
    Posts
    3

    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

  2. #2
    - - - - - - - - oogabooga's Avatar
    Join Date
    Jan 2008
    Posts
    2,808
    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.
    The cost of software maintenance increases with the square of the programmer's creativity. - Robert D. Bliss

  3. #3
    Registered User
    Join Date
    Oct 2006
    Posts
    2,364
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Computer turns off intermittently
    By VirtualAce in forum Tech Board
    Replies: 29
    Last Post: 12-21-2009, 06:07 AM
  2. Back buffering with GDI and System.Drawing.Graphics
    By MisterT in forum C# Programming
    Replies: 1
    Last Post: 09-18-2006, 12:01 PM
  3. computer just turns off
    By metsman20 in forum Tech Board
    Replies: 18
    Last Post: 10-13-2004, 08:21 AM
  4. global variable turns zero
    By Roaring_Tiger in forum C Programming
    Replies: 5
    Last Post: 04-07-2003, 12:52 PM
  5. Lightbulb turns on for DavidP
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 03-05-2002, 05:01 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21