Trouble Using Readdelim


Lexington

Recommended Posts

Hello,

I am experiencing trouble using ReadDelim. When I try to run:


global string SavedGraphs
private FileHandle = file.open("C:\DAQFactory\SavedGraphs.cfg",1,0,0,1)
SavedGraphs=file.ReadDelim(FileHandle,-1,",",chr(10),1)
[/CODE]

For the file with data:

[CODE]
First Graph,A7225,mm,A74424,mm,,,,,,,,,,,,,,,,,,,,,,,,,,,,
Moo,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
[/CODE]

it gives me {{"NaN","NaN"..."NaN"}}

However if I use parse instead:

[CODE]
global string SavedGraphs
private FileHandle = file.open("C:\DAQFactory\SavedGraphs.cfg",1,0,0,1)
SavedGraphs=parse(file.Read(FileHandle) ,-1,",")
[/CODE]

It gives me the correct values. However, I would rather use readDelim since it can parse returns. Is there something that I did wrong?

Lexington

SavedGraphs.txt

Link to comment
Share on other sites

  • 2 weeks later...

Thank you for the last tip. I saw it in the user manual but, I must have somehow missed it.

However, I now have another problem with readdelim, this time it is a bit more perplexing. Whenever I try to read the attached file, at line 22, the array that is read is {"","F74841",""} instead of {"F74841","","Centrifuge..."}. The lines above it are fine, however, the lines below it are shifted over as well.

Is there any way to fix that?

Point Descriptions.csv

Link to comment
Share on other sites

There is a line feed character after "Rate" and before the closing quote. Depending on the parameters passed to readDelim() this is probably throwing it. Note that you can't see the line feed in Notepad as it ignores them, but you can see it in Write.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.