LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to write into binary

Hi everyone,

 

I’m unable to write into a binary file from an executable application. It works if I run from the Labview NXG (4.0) development environment. File generation works in both.

 

Any suggestions?

0 Kudos
Message 1 of 7
(2,701 Views)

Hi Tofr4n,

 

suggestion: check the error you should get from the write operation. Then check the file path you are trying to write to…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 7
(2,691 Views)

No error messages.

The program generates the file in the expected path, just not write into it, so the file path seems to be correct.

And it works if I run form the development environment: the file generation, reading from file and writing to file works, so it’s wired for me…

Here is the general idea from what I’m trying to do:

Read from / write into binary fileRead from / write into binary file

0 Kudos
Message 3 of 7
(2,679 Views)

How are you confirming the data is not being written?  Are you looking at the file after your application is done?  Or are you using the code you just showed which contains a race condition (the read and write will attempt to run in parallel).  And how do you know you did not have an error?  I ask because I don't see any error handling.



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
0 Kudos
Message 4 of 7
(2,663 Views)

Ok sorry, I corrected the race condition. This example was just to clarify which functions I use and the wiring; maybe it wasn’t then …

readwrite.PNG

The file which was produced by the application is empty (0 KB), in contrast to the file from the development environment.

In the application I wait a few seconds after finishing my program to see there popup any error, but it didn’t.

0 Kudos
Message 5 of 7
(2,646 Views)

I unfortunately don't have NXG so I can only guess, but does it work if you write to a different folder location? You may have file access issues. LabVIEW may have write access but your executable might not.

0 Kudos
Message 6 of 7
(2,628 Views)

Yes I thought in the same direction, but enabling read/write access from windows option as well as start as admin also didn’t work.

0 Kudos
Message 7 of 7
(2,600 Views)