Subject:
|
Re: how does a line ends?
|
Newsgroups:
|
lugnet.cad
|
Date:
|
Sat, 7 Apr 2007 08:54:16 GMT
|
Viewed:
|
1553 times
|
| |
| |
Travis Cobbs schrieb:
> In lugnet.cad, Chris Phillips wrote:
> > There was some discussion about this issue recently. Unfortunately, this is
> > not the kind of problem that can be solved by tightening up the spec. The
> > problem is that people use different text editors on different operating
> > systems to create LDRAW files, resulting in files that do not have consistent
> > line termination. Changing the specification will not fix all the files that
> > are already "wrong", and it won't fix all the possible text editors, either.
> >
> > A better solution, in my opinion, is for all tools to be able to handle any
> > combination of LF or CR characters as a proper line feed. (And the spec
> > should spell this out.) This is not all that hard to do, and it makes life
> > easier for your users. The amount of programming effort to code defensively
> > is probably less than the effort just one of your users will go through if
> > they have to work around this problem.
>
> I don't fully agree with this. In the nearly seven years since I released
> LDView 0.1, I've never once run into an LDraw file that LDView couldn't handle
> due to line terminations, and it requires the newline character to be present at
> the end of each line. (The preceding carriage return is optional.) I'm not
> saying such files don't exist, but if so, they're exceedingly rare.
> Additionally, I suspect that they won't work with any of the major LDraw editors
> (although they might work with Bricksmith).
>
> Consequently, I feel that fgets is perfectly legitimate for reading lines, as
> long as the program can deal with both DOS and Unix line endings. I don't
> actually know for sure, but it was my understanding that fgetc is slow.
> Additionally, ungetc is documented to not be guaranteed to work, although in
> practice this appears to only be a problem if you call it twice in a row without
> an intervening read.
>
> --Travis
It seems that all of you are programming in C. As I am always
programming in VB it is much work to implement a new 'Line Input' as VB
assume a CRLF at the end of each line.
I have just run a little prog against the parts library and found only
one file that does not have CRLF at the end.
If you are saying it is not a problem to handle both ending CRLF and LF
in C, I like to have a CRLF as standard for LDraw files to make it
easier for programmers that spend a lot of time to do the best for the
community. Also it is a fact that approx. 80 to 90 percert of all users
are running a windows system. I think from that point of view we should
consider that as the standard.
cu
Mikeheide
|
|
Message is in Reply To:
| | Re: how does a line ends?
|
| (...) I don't fully agree with this. In the nearly seven years since I released LDView 0.1, I've never once run into an LDraw file that LDView couldn't handle due to line terminations, and it requires the newline character to be present at the end (...) (18 years ago, 7-Apr-07, to lugnet.cad, FTX)
|
24 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|