Re: line endings in LDRAW files (CRLF vs. LF vs. CR)


Re: line endings in LDRAW files (CRLF vs. LF vs. CR)
#20
First, I forgot to comment on the last newline discussion. Generally, I wouldn't recommend that files or output written by an application omit that last newline. especially as it's been in the file spec for so long. I was also surprised to see that the last lonely '0' has become discouraged. That was a great way to know the file was complete.

'readLine' operations expect that last newline, and STDIN is a different animal from a File Stream when it comes to really being done. I think shell and perl scripts will consider piped input complete when the first application exits regardless of receiving a final newline, but it's been a while since I coded for it. That also may be a feature of the shell, and not the language. A terminal or console usually won't write a line to the stream until the enter key is pressed. Character and byte operations are generally more flexible and can consume from a stream until it runs out. Although, I've also seen byte and char consumption coded to wait for the newline too before it considers a record or token complete, as it is typically a record delimiter in data file.

When I wrote a piped program in C long, long ago, I expected an EOF (Ctrl-D) or to indicate DONE! but the applications were coded to talk to each other, and networks weren't nearly as fast as they are now. With the advent of Java's Remote Method Invocation (RMI) and HTTP put/post, I've relied on those mechanisms to handle the communication between processes for quite some time now.

Can I ask what you're coding in? I can try a few different things and see how they behave. I can handle Java, most shells, perl, and I think I have an ANSI C/C++ compiler on Linux. I don't currently have .net on my PC.
- Greg
"The only stupid question is the one that remains unasked"
Reply
« Next Oldest | Next Newest »



Messages In This Thread
Re: line endings in LDRAW files (CRLF vs. LF vs. CR) - by Greg Teft - 2012-04-19, 3:20

Forum Jump:


Users browsing this thread: 1 Guest(s)