Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > self extracting zip files

Reply
Thread Tools

self extracting zip files

 
 
Andrew Edwards
Guest
Posts: n/a
 
      07-12-2003
I have program that downloads a file from the internet and extracts it using
calls to system(). All files are extracted into the directory where my
program is located. How do I redirect the extracted files to a specified
directory?

I can use the following:

system("move *.* c:\directory");

However, this will move my program. I end up having to call system for every
file in the directory since most of them are .exe.

Your assistance is greatly appreciated.
Andrew


 
Reply With Quote
 
 
 
 
Emmanuel Delahaye
Guest
Posts: n/a
 
      07-12-2003
In 'comp.lang.c', "Andrew Edwards" <> wrote:

> I have program that downloads a file from the internet and extracts it
> using calls to system(). All files are extracted into the directory
> where my program is located. How do I redirect the extracted files to a
> specified directory?
>
> I can use the following:
>
> system("move *.* c:\directory");
>
> However, this will move my program. I end up having to call system for
> every file in the directory since most of them are .exe.


By-definition, the contain of the string passed to system() is strongly
system-dependent. Better to ask on a newsgroup dedicated to your platform.

--
-ed- [remove YOURBRA before answering me]
The C-language FAQ: http://www.eskimo.com/~scs/C-faq/top.html
<blank line>
FAQ de f.c.l.c : http://www.isty-info.uvsq.fr/~rumeau/fclc/
 
Reply With Quote
 
 
 
 
Mr. 4X
Guest
Posts: n/a
 
      07-12-2003
"Andrew Edwards" <> wrote:

> I have program that downloads a file from the internet and extracts it
> using calls to system(). All files are extracted into the directory
> where my program is located. How do I redirect the extracted files to
> a specified directory?
>
> I can use the following:
>
> system("move *.* c:\directory");


Well... system(...) is standardized, but the OS commands that you can pass
to it are system specific.

BTW if you want to redefine the target directory into which a zip SFX is
unzipped to then you could try unzipping it with an unzip utility instead
of running it. Or maybe some kinds of the self extracting ZIPs could have a
command line switch to redefine the target directory. End of off topic
stuff

> However, this will move my program. I end up having to call system for
> every file in the directory since most of them are .exe.
>
> Your assistance is greatly appreciated.
> Andrew
>
>


 
Reply With Quote
 
ak
Guest
Posts: n/a
 
      07-12-2003
On Sat, 12 Jul 2003 19:19:13 GMT, "Andrew Edwards" <>
wrote:

|I have program that downloads a file from the internet and extracts it using
|calls to system(). All files are extracted into the directory where my
|program is located. How do I redirect the extracted files to a specified
|directory?
|
|I can use the following:
|
| system("move *.* c:\directory");
|
|However, this will move my program. I end up having to call system for every
|file in the directory since most of them are .exe.
|
|Your assistance is greatly appreciated.
|Andrew
|

maybe you could use the lib "Info-Zip" and build in the extract
function into your program, that would give you more control.

http://www.info-zip.org/pub/infozip/

hth
ak




--
g a n d a l f @ p c . n u
 
Reply With Quote
 
Andrew Edwards
Guest
Posts: n/a
 
      07-12-2003
"Emmanuel Delahaye" <> wrote:

> By-definition, the contain of the string passed to system() is strongly
> system-dependent. Better to ask on a newsgroup dedicated to your platform.
>


I would much rather eliminate the use of system(); However, since I'm new to
programming and did not want to ask you to do the work for me, I decided to
use the best thing I could find. Maybe you could give me a few pointers on
how to do this in standard C.

Thanks,
Andrew


 
Reply With Quote
 
Andrew Edwards
Guest
Posts: n/a
 
      07-12-2003
"ak" <ak @ workmail.com> wrote...

> maybe you could use the lib "Info-Zip" and build in the extract
> function into your program, that would give you more control.
>
> http://www.info-zip.org/pub/infozip/
>


Thanks, I'll look into it immediately.

Andrew


 
Reply With Quote
 
Malcolm
Guest
Posts: n/a
 
      07-12-2003

"Andrew Edwards" <> wrote in message
>
> I would much rather eliminate the use of system();
>

system() is cluntzy. You will hardly ever find it in real code (at least in
a games programming environment).
>
> Maybe you could give me a few pointers on how to do this in standard C.
>

C has no directory functions in the standard library. This was probably a
bad decison, but was presumably done since some platforms don't have
anything that could be described as a hierarchical filing system.

It is unusual for a non-trivial C program to rely entirely on the standard
library. You don't need to worry too much about using a platform-specific
extension to handle your directory operations. If portability is a concern,
you can isolate the platform-specific code in its own files. Then you
provide an interface to the rest of the program.

eg

char **listdir(char *path)

is your function to list all files in a directory (you will have to make a
decison on sub-directories and special files like UNIX ..).

Then for each platform you write code to list the directory. Under Windows
you use repeated calls to FindNextFile() after setting up FindFirstFile().


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Self Extracting ZIP Destination folder Nicknac Computer Support 0 08-12-2011 03:51 PM
Possibility to add a zip-file to a new zip-file with "add to zip" (right-click) ?? erikkie@casema.nl Computer Support 4 06-26-2006 12:18 AM
Self Extracting Zip File Question Bing Computer Support 3 06-17-2004 04:17 PM
Creating Self Extracting Zip using Python Calvin FONG Python 12 02-19-2004 02:36 PM
possible to read self-extracting zip file? Bomb Diggy Java 17 08-29-2003 08:42 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57