It's UWAweek 48


This forum is provided to promote discussion amongst students enrolled in CITS2002 Systems Programming.
Please consider offering answers and suggestions to help other students! And if you fix a problem by following a suggestion here, it would be great if other interested students could see a short "Great, fixed it!"  followup message.

Displaying selected article
Showing 1 of 919 articles.
Currently 2 other people reading this forum.

 UWA week 35 (2nd semester, week 6) ↓
SVG not supported

Login to reply

4:55am Tue 30th Aug, Christopher M.

"Cohen Rafiq" <23*4*9*[email protected]*u*e*t*u*a*e*u*a*> wrote:
> Aaah! sorry, your message didn't come up. Thank you for the response. I did try fflush and it still didn't work. I will try out setbuf( stdout, NULL );
I'm surprised that fflush() didn't appear to work for you. The following program works as I'd expect, flushing its output every 4th character.
#include <stdio.h>
#include <unistd.h>

int main(int argc, char *argv[])
    for(int i=0 ; i<20 ; ++i) {
        printf("%c ", 'a'+i);

        if((i%4) == 3) {
            printf("flushed ");
    return 0;

The University of Western Australia

Computer Science and Software Engineering

CRICOS Code: 00126G
Written by [email protected]
Powered by history
Feedback always welcome - it makes our software better!
Last modified  1:17AM Sep 14 2022
Privacy policy