0

I'd like to know why my test files for pset6 do not get highlighted for the lines that are the same. The official test files work though. What is happening inside my test files?

This is the test on cs50's offical test files: Hello.c and Hey.c.

Test on official test files

This is the test on my own files on my similarities program.

Test on my test files

Here's a test on my own files on CS50 staff's solution.

Staff solution on my test files

Here are the insides of my file1 and file2.

Inside my file 1

Inside my file 2

1
  • Have you tried with Windows-style CRLF and UNIX-style LF line endings? Would explain it if your files differ in that aspect (you can use tools unix2dos and dos2unix to convert text/source files)
    – Blauelf
    Commented May 28, 2018 at 6:40

1 Answer 1

1

Just tried with two files, one ending lines with CRLF (\r\n) and one with LF (\n). Comparing the CRLF file to itself will match only on the last line (not ending in CRLF), while the LF file will match itself on all lines.

So you most likely have your files uploaded with CP/M-, DOS-, Windows-style CRLF and not Unix-style LF. A text editor like Notepad++ allows you to pick the kind of line break inserted on hitting Return, also there are tools dos2unix and unix2dos to convert text files between the two standards.

(to make confusion perfect - Apple's OS before OSX, which is a BSD and therefore Unix-style, used CR/\r)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .