Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Processing CSV file, hit = char and stops

Aug
151
0
I'm guessing the '=' char is the culprit.

Just doing fileread in a do/while and today discovered it stopped prematurely. Guessing the '=' in the line it didn't process is the cause.

So, trial and error,

setdos /x-3
fileread
setdox /x0

gets around that problem.

So I'd like for the read to ignore (not interpret/process) any of the file content. Is there a single switch for that?

Fortunately @word can process the string now but if I try to echo it for debugging purposes, the batch file stops. Wrapping setdos around the echo doesn't work.

setdos /x-3
echo %lineread
setdox /x0
 
Last edited:
It might be helpful if you give the exact command line which fails, the contents of the line which causes the issue, and any error message.
 
You might try using more flags with SETODS. The CHM for SETDOS says:

For example, to disable all features except alias expansion while you are processing a text file containing special characters:

setdos /x-35678

... [perform text processing here]

setdos /x0
 
there is the safechars plugin on prospero.unm.edu to also consider...
 
yeah, saw the plugin reference during a search - I might try that but I wanted minimal dependency and just native TCC.

I'll try to assemble a simple test with script/data. There were no errors. Just when it hit the line with =, the script acted as though it had hit EOF.

I'd used TCC plenty of times to parse text files before and that's all I was looking to do. Just didn't know that it was apparently interpreting the chars read in and acting on them rather than just storing them as-is in a variable. Cool that you can do extra stuff with properly formatted text in a file but right now I just want to read, match a word in a column, and count++.

I just tried setdos /x-123456789 and that got me past line 70 to line 576 of 1149.

---hang on 35678 might have helped.....checking.....

nah, darn it. setdos is a ghost. fileread in two places. setdos wrapped around each. with setdos wrapped around the initial fileread 24 lines processed. comment that out and leave only the setdos in the do-while, 385 lines read. Sample data/script will probably be the only way to sort this out.
 
Last edited:
same thing happens if you have a folder named "C:\Program Files (x86)\Eltima Software\SWF & FLV Player" and do a pdir /(fpn). TCC interprets the "&"
 
What is "fileread"? Are you referring to the @FILEREAD variable function?

There isn't any issue with reading special characters in TCC; the problems arise when you try to display them with something like ECHO. That's where the special characters are being interpreted & processed.
 
Yes, sorry, meant to imply @FILEREAD.

So, that's great to hear - that READING should not be an issue.

I've simplified the original script/data such that I could still repro the issue.

Script/data attached and a video illustrating the test.
 

Attachments

  • readfile.zip
    1.5 MB · Views: 682
I've simplified the original script/data such that I could still repro the issue.

Script/data attached and a video illustrating the test.

The problem is with your DO comparison - your lines have embedded ='s (so DO doesn't know the comparison you want), and multiple double quotes (so DO doesn't know which is the first argument and which is the second.

You can work around it with something like this:

do while (%xdata) != (**EOF**)
 
  • Like
Reactions: ron
I started with an old batch file where I was parsing some simpler data from long ago. Don't recall why I was using quotes back then.

THANK YOU!!!
 

Similar threads

Back
Top