LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Scan a Text File

I want to search "Move to: safe_right" in a text file which is log and updates very fast. I have having trouble using scan from a file function.

Please convey how can I use scan from file fuction to scan "Move to: safe_right"

0 Kudos
Message 1 of 6
(2,362 Views)

The answer depends on many things. Who is modifying the file so fast?

 

One possibility would be to open the file read-only in parallel and keep reading from the last location, i.e. log entries since the last inspection. (There is no need to read the same thing from the beginning every time).

 

Is the code that writes the log to the file also LabVIEW code under your control? In that case it would be easier to trigger whatever needs to be done right there.

0 Kudos
Message 2 of 6
(2,351 Views)

The log file is not under my control and I am reading the file from the current position as  the file is changed. but the log file updates to fast and I am not able to scan the specified string. I also need to scan the file "Move to: safe_right" this particular but not able to do that. scan from file function throws an error- wrong format specifier.

0 Kudos
Message 3 of 6
(2,343 Views)

@himanshu25 wrote:

scan from file function throws an error- wrong format specifier.


We can't help unless you actually show us some code, in particular the format specifier you are using. I am not even sure why you need a format specifier. You don't even tell us the error code!

0 Kudos
Message 4 of 6
(2,340 Views)

You want to search but use "scan from file". "scan from file" does not search but scans according to the format you specify. If you want to search, you should use "match pattern" for example. Or do you have a very well formatted file, then scan from file could work, but please attach a sample of the file.

Certified LabVIEW Architect
0 Kudos
Message 5 of 6
(2,254 Views)

So, if you don't HAVE to use "scan from string", do like this.

Certified LabVIEW Architect
0 Kudos
Message 6 of 6
(2,248 Views)