The Daily CLAD

Community Browser
cancel
Showing results for 
Search instead for 
Did you mean: 

CLAD2017 - Fundamentals - File IO: 1 of 5

Active Participant

What is the value of String Length Out following execution of the VI?

 

NOTE:  Assume a Windows system and that no errors are generated by the VI?

 

Write then Read File.png

 

a) 0

b) 17

c) 18

d) 19

Combined.png

Comments
Knight of NI

A


There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
Member

A

File pointer needs to be set to start of file to read

Active Participant

A

Member

A

Member

A

Member

Hi guys,

I'm new and it's the first time I write, so excuse me for my english.
I  don't understand because the Read from Text File function returns

an empty string if I don't set to start of file to read (I suppose with Set File Position function).
Since count is -1, it should return all the string as output;

obviously I'm wrong, but why?

Knight of NI

When you tell the Read From Text File to read a count of -1, it will read all of the data starting at the current file pointer.  In this case, the file pointer is at the end of the file due to the Write To Text File moving the file pointer as it writes.


There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
Member

All right, I looked for it in the LaVIEW Help, but I didn't find anything about the pointer.
Thank you 

Member

A

Member

A. 

Active Participant

Answer: A.  Nice one all.

 

This question is a little bit mean Smiley Indifferent, but an important aspect of file access.

 

AlexBY makes a good point, the impact of File Position is not all that clear in the LabVIEW Help.  These links are a good starting point. Write to Text File, Set File Position, Read from Text File

 

Combined.png

Member

A