Author: Stan Eisenstat
Subject: Re: Carriage Return Issue
Date: Thursday, 30 Jan 2020, 08:15:58
> ... I am trying to write tests to help me with
> implementing line-splicing, however, my computer
> is inserting carriage return characters and the
> tests are failing for reasons other than my code
> logic. How should I handle this?
Andrew Sheinberg posted about this yesterday
If you are working locally on a Windows machine and you create a test file
make sure that the line endings are in Unix form.
Depending on the editor you use, hitting "enter" on a Windows machine to
create a newline corresponds to a carriage return, \r\n. This is really
two different ascii characters as opposed to a newline which is just, \n.
If you are using Sublime you can fix this by going to View -> Line Endings
-> Unix.
An alternative is to write a VERY short C program that
copies the standard input to the standard output but
does not copy carriage returns (i.e., '\r' in C). K&R
Chapter 1 contains nearly all of the code. You can use
this filter to remove the returns from your test cases.
Another alternative is to do your development in Linux,
not Windows.
--Stan-
PREV
INDEX
NEXT