PLEASE NOTE: this server,, will be unavailable on Wednesday 7th December, from 1pm until 4pm (was Monday 5th).
Web-based programs, such as csmarks, cssubmit, and the help fora, will all be unavailable.
  It's UWAweek 49


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 5 other people reading this forum.

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

Login to reply

2:39pm Mon 29th Aug, Christopher M.

"Cohen Rafiq" <23*4*9*[email protected]*u*e*t*u*a*e*u*a*> wrote:
> Hello, > I am having a weird error with my print statements where when I do printf("%c", ch); nothing prints on the screen but when I do printf("%c\n", ch); all the characters print a line apart. Do you have any idea why this might occur. I can confirm that this is the only line of code that changes in the entire program and when I went through it with a debugger, the print line does execute.
When using printf() the output is buffered (pending) until you 'flush' it out with a newline character, call fflush(stdout); or when the whole program terminates (and exit() flushes all non-empty output streams). If you want to always immediately flush all output (i.e. it is no longer buffered), add setbuf( stdout, NULL ); very early in main()

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