Assignment FAQ

This page provides answers to assignment specific questions.


Questions from previous semesters - they may be useful.

How do I stop my output from scrolling up off the screen?
On apserv1, when you run your program you can send the output through the "more" program to provide scrolling control. For example, if a program has been compiled into a.out, you would run it by typing
	./a.out | more
which will pause after a screenful has been displayed. You then have the option of pressing return/enter for the next line of output, or the space bar for the next screenful. This will work on Unix in general for programs that have output only (no input).

How can a program version run if it had compiler errors?
If you compile to a.out, then that executable file for an earlier version will still exist and work even if a subsequent compilation fails. In order to be really sure what is going on with each version, delete the executable file (if any) before each each compilation using the rm (remove) command. Ex: $rm a.out to delete your a.out file. If you compile to a specified executable file other than a.out, you will want to remove it instead.

When I compile, I get an error message stating "ld32: WARNING 84 : /usr/lib32/libm.so is not used for resolving any symbol."
This indicates a problem with the compiler installation which will not affect your programs.

Why do I get an infinite loop when I test for end of file?
With a character variable (char) the test == EOF will never be true because EOF is -1 and chars can only have positive values. Instead, use the function eof() to test for end of file.

If I try to open an input file that doesn't exist, why does it create the file instead of failing?
In your file stream open line if you say infile.open(filename, ios::nocreate) instead of leaving out the ios:: thing altogether, it forces infile.fail() to actually fail if the file doesn't exist and not create the file.


[CS109 Home] [Assignments] [Computer Use] [TA Info & Hours]
[Syllabus] [Ethics Code] [Dr. Houlahan]