sourceforge code carriage returns


hello, I downloaded some source code from sourceforge.  It's one of those deals where it is an open source project for both linux and windows, and there are separate build instructions for the two platforms.  what I downloaded was the source code in a .tar.gz format.

However after I unpack the .tar.gz (had to install winace to do it on windows), it appears that all the source code files are screwed up with respect to carriage returns.  Looks like valid C code, but all on one line.

Is it following a linux or apple format rather than windows?  Is there some sort of converter, or is it more likely that I downloaded the wrong version?  (there only appeared to be one source download at http://open-ms.sourceforge.net/download.php )

Anyway, any advice?  Thanks very much in advance.
riceman0Asked:
Who is Participating?
 
ollfriedConnect With a Mentor Commented:
What do you want to do, look at the code? Then just open it with wordpad. In Linux you can simply recode the newlines to cr+nl, but I don't know how to do this in windows.
0
 
Infinity08Connect With a Mentor Commented:
It probably uses a single \n (newline) character at the end of each line, while Windows expects two characters : \r (carriage return) and \n.

Usually however, Windows text editors correctly read them (and convert them) either way, so I'm surprised that didn't happen for you. Try opening it in a different text editor, and see if that works better.
0
 
riceman0Author Commented:
oh... now that you mention it both wordpad and visual studio can deal with it and it looks correct.  But notepad does not.

What's going on, is it CR instead of CRLF?

0
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

 
riceman0Author Commented:
Got it, thanks guys.
0
 
Infinity08Commented:
>> What's going on, is it CR instead of CRLF?

Depending on the editor used to write the code, it might be. You could always check that with a hex editor.
0
 
ollfriedCommented:
Yes, that's it. Unixes use only newline windows needs an additional carriage-return. Notepad cannot deal with that.
0
 
Infinity08Commented:
I seem to recall that notepad shows a block instead of the newline character, so even if the newlines aren't interpreted correctly, at least you get a visual clue that something went wrong.
Maybe they changed that in the most recent versions of Windows ?
0
 
Infinity08Commented:
>> You could always check that with a hex editor.

Just checked on a random source file from the archive you linked to, and it was using newlines as line delimiters (standard UNIX).
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.