Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > microsoft.public.scripting.vbscript > #12423

Re: EOL type detection

From "R.Wieser" <address@not.available>
Newsgroups microsoft.public.scripting.vbscript
Subject Re: EOL type detection
Date 2022-03-08 11:03 +0100
Organization Aioe.org NNTP Server
Message-ID <t07aqf$1ipv$1@gioia.aioe.org> (permalink)
References <bb79q57z2c92.16pyyy6q0tjfm.dlg@40tude.net> <svvt9e$v97$1@gioia.aioe.org> <1nd3b1sdbo4kn$.fh7v45y1h0o8.dlg@40tude.net> <t01tif$gr4$1@gioia.aioe.org> <plz8ewgg7q5s$.77xbms15aox6.dlg@40tude.net>

Show all headers | View raw


JJ,

> Fortunately, none of my input file will be like that.

:-) And there I was, thinking that that "on error resume next" was the 
result of defensive programming.

> That is another way to do it, but the disadvantage outweighs the benefit.

As I said, it comes with a cost.  Its upto you to decide if its worth it.

But do realize that that character-by-character reading of the file is 
buffered internally, so the performance hit is probably less than you might 
think.

Also, if you know what the input file looks like you could choose to just 
'read(xxx)' the first few KB - a few lines worth - and determine the EOL 
type from it.

> That's surprising. I didn't except WordPad to actually support Mac EOL.

I didn't say it /supports/ Mac EOLs, just that it /displays/ in an expected, 
readable way.  No idea what happens when you edit and than save such a file 
(didn't go as far as to test that).  It could easily become one of those 
frankenmonster files, mixing different types of EOLs ... :-\

> No need in my case, because if there's actually one which uses Mac
> EOL, it will fail the data validation which is done later in the
> script anyway.

In that case, are you sure you actually want to preserve the EOLs in the 
file and not just (temporarily?) reformat the file in question ?  It could 
result in something parsable.

Than again, I get the feeling that speed is of the utmost importance to you 
and everything else comes second - even getting results.

Regards,
Rudy Wieser

Back to microsoft.public.scripting.vbscript | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

EOL type detection JJ <jj4public@gmail.com> - 2022-03-05 15:39 +0700
  Re: EOL type detection "Mayayana" <mayayana@invalid.nospam> - 2022-03-05 08:57 -0500
    Re: EOL type detection JJ <jj4public@gmail.com> - 2022-03-06 06:27 +0700
  Re: EOL type detection "R.Wieser" <address@not.available> - 2022-03-05 15:49 +0100
    Re: EOL type detection JJ <jj4public@gmail.com> - 2022-03-06 06:28 +0700
      Re: EOL type detection "R.Wieser" <address@not.available> - 2022-03-06 10:06 +0100
        Re: EOL type detection JJ <jj4public@gmail.com> - 2022-03-08 05:36 +0700
          Re: EOL type detection "R.Wieser" <address@not.available> - 2022-03-08 11:03 +0100
            Re: EOL type detection JJ <jj4public@gmail.com> - 2022-03-09 09:30 +0700

csiph-web