flush stdout?

This is a discussion on flush stdout? within the C Programming forums, part of the General Programming Boards category; hi is there a way to flush stdout before calling printf?...

  1. #1
    Registered User
    Join Date
    Apr 2007
    Posts
    32

    flush stdout?

    hi

    is there a way to flush stdout before calling printf?

  2. #2
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,211
    Code:
    fflush(stdout);

  3. #3
    Registered User
    Join Date
    Apr 2007
    Posts
    32
    ah ok pretty straight forward thanks mate

  4. #4
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,473
    Just curios - why do you need it BEFORE printf?
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

  5. #5
    Registered User
    Join Date
    Apr 2007
    Posts
    32
    not exactly before printf... i said before printf to make the question more understandable for what i'm trying to do...

    But what happened was that from after a fork i was calling a function, where while this function was getting executed before getting ready to print, the caller of the function was waiting on a signal to print a long stream, where when the child prints his stuff(before sending the signal it was getting mixed with the stuff of the caller which i didn't want to show yet.... Anyway tried to explain it... but it worked now

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Case Statement
    By danlee58 in forum C Programming
    Replies: 16
    Last Post: 11-23-2008, 07:46 PM
  2. Replies: 2
    Last Post: 07-12-2008, 12:00 PM
  3. forcing stdout of external program to be line-buffered
    By FreakCERS in forum C Programming
    Replies: 4
    Last Post: 09-17-2006, 12:46 PM
  4. Problems with switch()
    By duvernais28 in forum C Programming
    Replies: 13
    Last Post: 01-28-2005, 09:42 AM
  5. How do I print a pattern flush right?
    By Basia in forum C Programming
    Replies: 5
    Last Post: 06-11-2002, 07:15 AM

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