It's UWAweek 48

help2002

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


 UWA week 36 (2nd semester, mid-semester break) ↓
SVG not supported

Login to reply

👍x1
helpful
5:09am Tue 6th Sep, Christopher M.

ANONYMOUS wrote:
> Yes, I asked this question poorly, my bad. My program is reading the file but it's duplicating desired lines for the total number the lines of the file (e.g 7 desired lines, printed 19 times - the total lines of file). How do I remove duplicate lines when reading the file (as it's in a while loop)?
This sounds like a simple coding problem (in your code), not a misunderstanding, or something strange, with C's semantics. There are no 'duplicate' lines. It's *your* code that's printing any duplicate (copies of) lines, so you'll need to follow the sequence of statements in your code to find out why. Break the problem down into small steps - what is printed (hopefully nothing) when reading a file containing *no* lines; what is printed in a file of just one comment-line, in a file with just one command-line, etc. Work out where the duplicate printing is happening.

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