Find the answer to your Linux question:
Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Query regarding buffering in streams

    I could able to do the follwoing thing in linux, aix but not in IRIX.

    cat testfile.dat | testprog

    testfile.dat is the input to testprog.

    testprog could able to get all the input properly in Linux without using setbuf in "testprog"but failed in IRIX. So when I used

    setbuf(stdin, NULL) in "testprog" where I am opening stdin explicitly it worked well. Can anyone explain me what is going on explaining me the usage of setbuf, setvbuf with clear understanding using streams. I jst hve a vague idea and made it work.

    with regards,

  2. #2
    Linux Guru
    Join Date
    Oct 2001
    Täby, Sweden
    I recommend that you check the manpage for setbuf; it explains it all in detail.
    By the way, why "cat testfile.dat | testprog"? Why not just "testprog <testfile.dat"?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts