LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Odd Open/Create/Replace File Behaviour

Solved!
Go to solution

Hi all,

 

I will make my question as general as possible as I believe someone must have come accross this behaviour before. I am using the Open/Create/Replace File function to programmatically open a file, by giving a path input created in an earlier vi. The odd behaviour I observe is that although Labview returns Error 1 when I give my file programmatically, it reads the file OK if I give it as a constant. The path constant I give is exactly the same as the one I am tryinng to give programmatically.

 

Any suggestions? Is it to do with some string formatting problem? I have attached my portion of VI dealing with the path_in section.

 

Thanks for your time,

 

Regards,

Harry

 

0 Kudos
Message 1 of 3
(2,282 Views)
Solution
Accepted by topic author charmand79

Wild guess: You need to use "build path" instead of "concatenate strings" to built the path.

 

(Also use a path diagram constant (not a string!) for "c:\ni-rt\" and get rid of the "trim whitespace" and "string to path".)

 

See if it makes a difference. (build path is OS independent while string operations are not).

 

Never operate on paths as strings. There are very few instances where that would be appropriate.

0 Kudos
Message 2 of 3
(2,256 Views)

Thanks altenbach,

 

I followed your advice and was able to sort it out..

 

Cheers

0 Kudos
Message 3 of 3
(2,233 Views)