using linux and using windows
Some of you prefer to do the programming on Windows, and then email the result
to Linux for submitting. That is okay, except you need to beware of the following
problem. A student writes:
Hello Dr. Patt
I had an error in my code that took me hours to figure out but I finally realize
it is because my lines are ending in "\r\n" thus when the los word is tokenized,
the '\r' is appended to it and is treated as part of the word causing my program
to fail. One example of how it fails is when I call your toNum(char*) function.
If the last argument is "x3000", it's read as "x3000\r" and so it never passes
the isxdigit() test.
Do you know if there is a setting somewhere that I can change to stop this '\r'
from being placed at the end of my lines?
I know you said to direct C questions to the TA's and I plan on asking them but
there are no more TA office hours today and I really want to get this working.
<<name withheld to protect the student who took hours to figure it out>>
So, a few things are relevant. Although it is true that I prefer you see the TAs
during office hours, they have been known to answer email on questions dealing
with the programming labs, ...if they happen to be logged in. Please try not to
abuse them since they tend to be very accomodating, and they do have their own
work to do. But we would all rather you did not remain stuck, so use your
Also, I have no problem with you getting help with C syntax from anyone who can
provide it, PROVIDED there is nothing in the question or answer that relates
specifically to the programming assignment. I am very happy to have you help
each other with strictly programming skills. However, if the question or
answer directly relates to the programming assignment, you have crossed the
line. When in doubt, do not ask, but FIRST ask the TA or me first whether
such a question is okay to ask another student in the class.
Finally, the question raised by the student. The problem he had was that
Windows uses \r\n (two characters) at the end of every line, and Linux uses
one. So, the file he shipped from Windows to Linux had an extra \r character
at the end of each line. A simple solution, if you do your work on Windows
and ship the results to linux is to use the Unix command dos2unix on all files
copied from Windows. The dos2unix command strips away the extra \r characters.
OKAY? Good luck.