The Daily CLAD

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

Re: CLAD2017 - Fundamentals - File IO: 1 of 5

SercoSteveB
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

Comments
crossrulz
Knight of NI

A


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Vinay_Kumar_M_S
Member

A

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

mini09
Active Participant

A

A_rid
Member

A

nik35324
Member

A

AlexBY
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?

crossrulz
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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
AlexBY
Member

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

qubirt
Member

A

Matt-A.
Member

A. 

SercoSteveB
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

 

A.Bernau
Member

A

istan0227
Member

A