07-12-2017 01:41 PM
Why cant I go inside a .zip folder and open a file using labview. Why do I have to unzip it first which create memory issue for me.
I tried go in directly in the zip file to find the file but I could not. Can Labview do it or am I just doing it wrong....
Solved! Go to Solution.
07-12-2017 03:28 PM - edited 07-12-2017 03:34 PM
Just because your explorer shell has support for opening zips natively, doesn't mean LabVIEW does. The native LabVIEW zip functions cannot go inside a zip and pull out a single file from it. But the OpenG zip tools developed well before the LabVIEW ones can do this. Using the "Open Unzip" then "Extract" then "Close Unzip" you have the ability to pull out a single file, extracting it where you'd like. It sounds like you really just want to be able to read the contents of it easily so you may want to extract it to a temp location, read it, then delete it when you are done.
The OpenG zip utilities can be found on the tools network or here, installed with VIPM.
EDIT: I saw this on the idea exchange, you might want to go vote for it if you are interested in NI having this functionality.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
16 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
07-12-2017 04:11 PM
In addition to what Hooovahh said, the OpenG library also supports extracting files from an archive directly into a (binary) string. Look for the ZLIB Extract Stream.vi instead of the ZLIB Extract File.vi. Then you can avoid the saving of a file to a temporary location to read it and having to delete it afterwards.
07-12-2017 08:23 PM
I have done similar to what hooovahh described with OpenG, but I used 7Zip. There is a nice command line interface so you can extract only the file you want.
07-20-2017 03:52 PM
Thanks a lot, I used your method and it works well. Now I just extract the files I want only.
Only problem is it does not read file from external drives. when I use it for my local C drive it works fine. On my E drive it gives me error 7, file not found.....Not sure why?
07-21-2017 03:36 PM
It looks like there are some kinks in OpenG. Take a look at this lavag forum and make sure that your drive letter is specified in the correct case:
https://lavag.org/topic/16961-zlib-crio-vxworks-bug/#comment-104187
Otherwise, any error code screenshots that you could provide?
Best,
07-21-2017 04:39 PM - edited 07-21-2017 04:42 PM
Ok so I thought it was because of the zip folder was in the E drive. But I realize that's not the case. I used a diff Zip folder to extract files from and it worked fine. The other ones it does not when It goes extract the file. I check on access right on the file and everything is fine. But it gives Error 7 Lib Unzip Archive and when I open the Unzip Archive and analyze it. I notice that It sees the file but the call Library of the dll return 0 every time.
07-22-2017 05:17 PM
I really would like to check this, but your error description is pretty unclear to me. I don't understand which function returns that error nor which function does return 0!
Can you do some single stepping and explain to me exactly which low level VI returns what error or other specific values?
07-22-2017 05:18 PM - edited 07-22-2017 05:19 PM
@SamuRei wrote:
It looks like there are some kinks in OpenG. Take a look at this lavag forum and make sure that your drive letter is specified in the correct case:
https://lavag.org/topic/16961-zlib-crio-vxworks-bug/#comment-104187
Otherwise, any error code screenshots that you could provide?
Best,
That was on VxWorks cRIO targets. As far as I understand it the last problem was about USB or similar volumes under Windows and under Windows there definitely shouldn't be a case sensitivity in file names in any way.
07-24-2017 09:45 AM
Hi,
These are the screen shots where the error happen. at the ZLIB open Unzip vi.
At the call library function node, fist U32 output