LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Scan From File.vi

Hi all,

I need to scan a string value in from a file. This works fine when the
string contains no spaces. Is there anyway to get the Scan from File VI
to scan an entire string (with variable number of spaces) and use the
newline character as the delimiter and not the space?

thanks,
stephen
0 Kudos
Message 1 of 5
(3,149 Views)
If you just want to read one line at a time as a single string, instead of using Scan From File, look at Read File (on the File I/O function palette)or Read File+ (C:\Program Files\National Instruments\LabVIEW 6.1\vi.lib\Utility\FILE.LLB\Read File+ (string).vi) with line mode True and count=0.
0 Kudos
Message 2 of 5
(3,149 Views)
Hi stephen,

Enter the format string "%[^\n]" which tells to scan for a string that does not contain a new line. To see about format strings, right-click on the "Scan from String" node and select "Edit format string". That open a window allowing to easily build the format string showing the available options.


LabVIEW, C'est LabVIEW

0 Kudos
Message 3 of 5
(3,149 Views)
Thanks for the reply,

I'm reading many values from the file. Most are integers which work
well with the Scan From File. However, there are a couple of strings
that I need to read in also. I hate to use the Read File as I would
need an instance for each file field. Is there any other way?

Al S wrote:
>
> If you just want to read one line at a time as a single string,
> instead of using Scan From File, look at Read File (on the File I/O
> function palette)or Read File+ (C:\Program Files\National
> Instruments\LabVIEW 6.1\vi.lib\Utility\FILE.LLB\Read File+
> (string).vi) with line mode True and count=0.
0 Kudos
Message 4 of 5
(3,149 Views)
Thanks!

Jean-Pierre Drolet wrote:
>
> Hi stephen,
>
> Enter the format string "%[^\n]" which tells to scan for a string that
> does not contain a new line. To see about format strings, right-click
> on the "Scan from String" node and select "Edit format string". That
> open a window allowing to easily build the format string showing the
> available options.
0 Kudos
Message 5 of 5
(3,149 Views)