LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

BUG: "File/Directory Info" size parameter too small

"File/Directory Info" size parameter too small.

When looking for a file where the file size exceeds 2 147 483 647 bytes the size value is not returned since size is an I32. The size parameter should be U64 so that files as large as 9.22337204E18 can be identified.

Is there a work around for this bug?

0 Kudos
Message 1 of 14
(3,928 Views)
You're probably using pre 8.2. In 8.2 that output is an I64. Other than upgrading, the alternative would be to hook into an OS call, probably. What OS are you running?
0 Kudos
Message 2 of 14
(3,920 Views)
I'm using LV 8.5. However, this code was originally done in 2001.
 
Even so the docs for 8.5 say the size is I32:
 
0 Kudos
Message 3 of 14
(3,906 Views)
Then the documentation is wrong. If you place that function on a brand new VI, and right-click on the output and select "Create Indicator" you'll get an I64 with no data coercion, which means the output is an I64. Do you see a coercion dot on your I32 output? If so, right-click on the indicator and change its datatype to I64 and see if you get the right value.

Also, according to the bug fix list of 8.2.1, this function did not work properly for 8.2, as noted in this thread.
Message 4 of 14
(3,901 Views)

Thank you for your help. I see that this VI allows me to connect size to any type of indicator, I8, I16, I32, I64. I'm not really proficient in LV so I assume that the output is polymorphic. In fact I am able to connect an I64 control to an I8 indicator without any problem. That surprises me, since one should not be able to do this, an overflow is eminent.

I created a VI to look at this issue and it appears that the indicator is automatically cast to the smaller size, if I64 = 3557097889 (0xD40501A1) , then I32 = -737869407 (0xD40501A1), I16 = 417 (0x1A1).

Dangerous stuff if you ask me!

 

0 Kudos
Message 5 of 14
(3,886 Views)
Outputs are not polymorphic. Inputs, however, can be. Just because an output is, say an I8, doesn't mean that you cannot wire it to an I32 indicator. What will happen is that you will see a coercion dot on the indicator. This is LabVIEW telling you that it's automatically upcasting the I8 to an I32:

Note the red dot to indicate a coercion of data happening.

If you downcast, you will obviously get the data coerced to be within the limits of the downcast datatype. This is not dangerous. It is by design. It's up to you as the programmer to realize this, and this is true in any language, not just LabVIEW.

When you converted the VI to 8.5 LabVIEW did not change the datatype of the indicator, as this is not something that LabVIEW is really supposed to do. In this case you would need to change the datatype yourself to adapt to the new function.



Message Edited by smercurio_fc on 03-03-2008 12:04 PM
0 Kudos
Message 6 of 14
(3,881 Views)


mefitzpatrick wrote:

Thank you for your help. I see that this VI allows me to connect size to any type of indicator, I8, I16, I32, I64. I'm not really proficient in LV so I assume that the output is polymorphic. In fact I am able to connect an I64 control to an I8 indicator without any problem. That surprises me, since one should not be able to do this, an overflow is eminent.



Yes, this is the documented behaviour. In the LabVIEW help, select the index tab and scroll to "numeric -> conversion" for the full set of rules. This is broadly the same as other programming languages will do if you assign (say) a 64 bit value to an 8-bit variable. Many compilers will issue a warning for such mixing of sizes. In LabVIEW your warning is the (red) coercion dot
 
Rod.
 
PS In Rev 8.2 the "Get file size" documentation does state the output value to be I64, unlike "File/Directory info" for which the documentation has I32, and the code is I64. I don't have a large enough file to see if the information returned is correct.
 
0 Kudos
Message 7 of 14
(3,872 Views)

Thank you for all your help.

I have indeed tested the VI and it does work as you say, even though the Help docs are in error. The problem came to my attention when a particulally large file was created after a 10 hour operation. A typical file after 90 minutes is about 300 MB, the test to stress the system created a 3.3 GB file after 600 minutes. In the VI a test for file size > 1 MB failed even though the file was much larger.

Also, I learned about the VI coersion dot. I will keep my eye out for it in the future.

 

0 Kudos
Message 8 of 14
(3,867 Views)
Outputs can be polymorphic. See for example the Variant to Data function.

Regards,

Wiebe.


0 Kudos
Message 9 of 14
(3,836 Views)
Oh, yeah. That one. That's just a weird one anyway. Smiley Wink
0 Kudos
Message 10 of 14
(3,832 Views)