Re: Using GZip decompression in VB 6




<flanaganseanie@xxxxxxxxx> wrote in message
news:1151650194.581082.295490@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Stoil Marinov wrote:
Hi Sean,

I use the gzip.exe utility, starting it from VB:
http://www.gzip.org/

Regards,

Stoil

Thanks Stoil,

Do you have any example code? I would be interested to see what the
parameters are.

Thanks

Sean



I do not have a stand alone sample code, sory.
I use two options only:
1. List the compressed file attributes.
2. Decompress the gzip file.

And here is how the Shell() command looks for each of these cases:

1. C:\WINNT\system32\cmd.exe /C D:\0000\gzip.exe -lv D:\0000\Test1.txt.gz >
D:\0000\Out.txt
2. C:\WINNT\system32\cmd.exe /C D:\0000\gzip.exe -dvf D:\0000\Test1.txt.gz >
D:\0000\Out.txt

In the above commands /C after the cmd.exe means for the Command promtp
window to close automatically after the program finishes.

D:\0000\Out.txt redirects the gzip.exe program output to a text file, so
my program can read it.

Also, do not hardcode the path and name of the Command prompt EXE, if you
run your program on different platforms.
Use Environ$("Comspec") to get the correct path and name to the Command
prompt.

Since Shell() starts the program asynchronously, if you want to wait until
it has finished, check this link fo how it is done:
http://groups.google.com/group/comp.lang.basic.visual.misc/browse_frm/thread/a53f05064dda5044/2585ddd6918270a3?lnk=st&q=Re%3A+SHELL+stoil&rnum=5&hl=en#2585ddd6918270a3

There are two essential things to note:
- each .GZ archive containes only one file;
- when the file is decompressed, the original .GZ file is replaced by
the decompressed one which is renamed with the same name minus the .GZ
extension.

Taking the above into account, if you need to extract the .GZ file in
certain directory, you must first copy the .GZ file in that directory and
then extract it. Or you can extract it in whatever directory it is currently
and then copy the extracted file into the directory you need it to be.
There is no way for you to specify a directory where the extracted file
would go as you could with the unzip.exe utility.

Hope this helps.

Regards,
Stoil

.



Relevant Pages

  • Problems using Expect to parse a file
    ... I'm trying to write a script to automate a program called DeltaE, a powerful thermoacoustic design tool, and to extract performance data from the simulations it runs by parsing through its output files. ... Less, on the other hand, remains open upon reaching the end of a file until it receives the "q" command, so I tried writing a script to step through the file using that, as follows: ... The trouble now is, although manually executing the command "less -c data/1.out" at a tty functions just as you would expect it to, when Expect sends the exact same command as part of the spawn process, and running the script with exp_internal true, apparently none of the data sent to the display by less when started normally is being seen by Expect - all it seems to get is "No tags file\r\n", followed by eof and closure of Less - I'm afraid I haven't a clue what the "No tags file" statement means. ...
    (comp.lang.tcl)
  • Re: Extract single file from XP CD
    ... > about using MSCONFIG to extract a single file from the XP CD, ... (Command Prompt window opens) ... Type in these commands ... regsvr32 oleaut32.dll ...
    (microsoft.public.windowsxp.setup_deployment)
  • Re: default stanza in AIX 5.2 /etc/security/limits?
    ... Sorry about the /tmp permissions issue. ... I usually extract to a directory like ... Maybe chsec would be a better command for default stanza, ...
    (AIX-L)
  • Re: bootpImage error with 2.6.19.2
    ... I am trying to create a bootpImage for 2.6 kernel. ... To boot the board I had first used the nand read command from redboot ... The parameter INITRD_PHYS specified the location where to decompress ...
    (comp.os.linux.embedded)
  • Re: default stanza in AIX 5.2 /etc/security/limits?
    ... If you have a base level package can you not ... etc/security/limits is a file from that fileset, when I go to extract or just list the contents of my bos.rte.security fileset from the install medium, I don't see that in there. ... As for the chsec command, that looks to be the one to use, specifically with the "-s default" flag. ... default stanza in AIX 5.2 /etc/security/limits? ...
    (AIX-L)

Loading