From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

format into file and scan from file

Hi,

 

The could I have uploaded uses format into file and scan from file. Format to file, creates a new file.txt and stores ip address and port number. Scan from files read this from the file and gives it to tcp open communication. But when I run the program there are 2 errors.

 

Error 85 occurred at Scan From File (arg 5) in wrire and scan from file.vi

Possible reason(s):

LabVIEW: Scan failed. The input string does not contain data in the expected format.

 

Error 54 occurred at TCP Open Connection in wrire and scan from file.vi

Possible reason(s):

LabVIEW: The network address is ill-formed. Make sure the address is in a valid format. For TCP/IP, the address can be either a machine name or an IP address in the form xxx.xxx.xxx.xxx. If this error occurs when specifying a machine name, make sure the machine name is valid. Try to ping the machine name. Check that you have a DNS server properly configured.

 

Can someone help me and tell me what is the problem and how to do this properly. Thanking You. 

0 Kudos
Message 1 of 20
(4,469 Views)

You have no dataflow.  There is no way to predict if this program will read the file BEFORE it's even written.  You can use the error terminals to control the flow of execution in this case.  I would go further and separate the tasks into two subVIs and call them in a main VI.

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019 - Unfortunately now moving back to C#, .NET, Python due to forced change to subscription model by NI. 8^{
0 Kudos
Message 2 of 20
(4,456 Views)

i connected the error terminals, its still not working. Please help me. Thanking You.

 

 

0 Kudos
Message 3 of 20
(4,441 Views)

Why are you putting a  CRLF into the middle of the data you are writing?  That often will mess up andy Scan From Strings.

 

But the bigger problem is that you need to read the help file on Format Codes.  The Scan from String doesn't know how to handle the words that you have in the file (and probably not the CR/LF characters either).  If you create a scan string format that matches the data as you have it programmed, then you'll have a chance of making your code work.

0 Kudos
Message 4 of 20
(4,428 Views)

What exactly are you trying to accomplish here?

 

Anyway at first glance I see two things that may be causing your grief.

 

FF.PNG

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 5 of 20
(4,423 Views)

Ok, what i really require is to store an ip address and port number in a .txt file and then later read it from this file and give it to the tcp open connection. So what can be done to achieve the same. Thanking You. 

0 Kudos
Message 6 of 20
(4,417 Views)

Well what you have started might be better, but I have never used those primitives, so I would probably do something like this.

 

Filex.png

 

Edit: I attached the file it created TEST.TXT

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 7 of 20
(4,405 Views)

Hi, thank you very much. But i dont know the names by heart. So could u upload the vi itself. Or tell me the names of each item. Thanking You.

0 Kudos
Message 8 of 20
(4,391 Views)

That image is a "VI Snippet" you can copy and paste or drag and drop it right into a block diagram. 

 

http://zone.ni.com/reference/en-XX/help/371361M-01/lvhowto/create_visnippet/

 

But I think you need to use Internet Explorer for drag and drop to work properly

 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 9 of 20
(4,381 Views)

Why not use INI files on the configuration file palette?  EDIT: 2011 snippet.

 

Example_VI_BD.png

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 10 of 20
(4,369 Views)