By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
439,993 Members | 1,883 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 439,993 IT Pros & Developers. It's quick & easy.

Download, Zip, and extract

P: n/a
We have created a game and when the user click on "Download New Songs"
which requires the user to download songs.

This could be over 20 songs.
I have these files zipped on the server in one *.zip file.

Is there any c++ code, or library that could help me do the following.

Download zip file to users computer.
Unzip the file and extract the files into songs subdirectory.
Delete the zip file.

Can this be done?

Aug 19 '06 #1
Share this Question
Share on Google+
7 Replies


P: n/a
John wrote:
We have created a game and when the user click on "Download New Songs"
which requires the user to download songs.

This could be over 20 songs.
I have these files zipped on the server in one *.zip file.
MP3 format is already compressed, so ZIPping them just adds clutter.
Is there any c++ code, or library that could help me do the following.
You should use Google Groups to find either the answer or the best forum for
your question. This newsgroup is only qualified to discuss the raw C++
language itself. Your OS will have downloading functions.

--
Phlip
http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!!!
Aug 19 '06 #2

P: n/a
Is there any c++ code, or library that could help me do the
following.
>
Download zip file to users computer.
Unzip the file and extract the files into songs subdirectory.
Delete the zip file.

Can this be done?
Of course, why couldn't it be done? I'm sure there are libraries which
can do this. Curl could probably do the download part ( depending on
the protocol you need ). But all third party libraries are off topic
in this newgroup.

-Brian

Aug 19 '06 #3

P: n/a

Phlip wrote:
John wrote:
We have created a game and when the user click on "Download New Songs"
which requires the user to download songs.

This could be over 20 songs.
I have these files zipped on the server in one *.zip file.

MP3 format is already compressed, so ZIPping them just adds clutter.
Where did the OP state MP3 is the format? I must have missed that.
There are may audio formats other than MP3.

-Brian

Aug 19 '06 #4

P: n/a
In article <11*********************@m79g2000cwm.googlegroups. com>,
wo**@brianmielke.com says...

[ ... ]
This could be over 20 songs.
I have these files zipped on the server in one *.zip file.
MP3 format is already compressed, so ZIPping them just adds clutter.

Where did the OP state MP3 is the format? I must have missed that.
There are may audio formats other than MP3.
There are other formats, but most are already compressed, so the same
comments apply. Zip will do some good on a pure PCM file (e.g. .wav
file) but that's just about it -- and something like MP3 or ogg will
compress the same file a LOT more.

OTOH, if you view zip as a pure archiver, it's not particularly terrible
-- most implementations of zip are smart enough to just store files that
won't compress, and the software to extract from the archive and such
are probably more widely available than for most pure archivers like ar.

--
Later,
Jerry.

The universe is a figment of its own imagination.
Aug 19 '06 #5

P: n/a
BigBrian wrote:
This could be over 20 songs.
I have these files zipped on the server in one *.zip file.

MP3 format is already compressed, so ZIPping them just adds clutter.

Where did the OP state MP3 is the format? I must have missed that.
There are may audio formats other than MP3.
You may have missed the question is off-topic. Hence I can say anything I
like, so long as I bounce. And please note everything I said was true.

--
Phlip
http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!!!
Aug 19 '06 #6

P: n/a
"John" <ko*****@nextlevelsw.comwrote in message
news:11**********************@i42g2000cwa.googlegr oups.com...
We have created a game and when the user click on "Download New Songs"
which requires the user to download songs.

This could be over 20 songs.
I have these files zipped on the server in one *.zip file.

Is there any c++ code, or library that could help me do the following.

Download zip file to users computer.
Unzip the file and extract the files into songs subdirectory.
Delete the zip file.

Can this be done?
Yes. google search for what you need and add "c++ source" after it. I have
found a socket class source that way (download zip file to users computer)
and zip source (extract the files into songs subdirectory). Deleting the
zip file is trivial.
Aug 19 '06 #7

P: n/a
Hi,

If you are on MS-Windows you might want to user the internet api, below is
an example of some part of my own program that ftp's files (this part
doesn't send files but if you lookup the api that is pretty easy to add).:

If you can decide how the files are compressed you could 'gzip' them and
unzip them with zlib library (works on ms-windows (by linking you program to
zlib.lib) as well as on most linux/unix systems (by including libz.a or
libz.so to your prorgram) (http://www.zlib.net/). This library is very easy
to use.

Regards, Ron AF Greve





---------------------------------------------------------------------------------------
#include <shlwapi.h>
#include <shlobj.h>
#include <afxpriv.h>

if( InternetAttemptConnect( 0 ) == ERROR_SUCCESS )
{

if( !( Session = InternetOpen( Server, INTERNET_OPEN_TYPE_DIRECT, 0, 0,
0 ) ) )
{
AfxMessageBox( _T( "Could setup internet session" ) );
Succeeded = false;
}
else
{

if( !( Connection = InternetConnect( Session, Server,
INTERNET_DEFAULT_FTP_PORT, User,
Password, INTERNET_SERVICE_FTP, 0, 0 ) ) )
{
AfxMessageBox( _T( "Could not establish ftp session" ) );
Succeeded = false;
}
else
{
if( !FtpSetCurrentDirectory( Connection, RemoteDir ) )
{
AfxMessageBox( _T( "Could not set current dir" ) );
Succeeded = false;
}
else
{
if( !FtpCreateDirectory( Connection, _T( RemoteDir + "/" +
RelBackup ) ) )
{
//AfxMessageBox( _T( "Could not set current dir" ) );
//Succeeded = false;

}
}
}
}
}
--
Regards, Ron AF Greve

http://moonlit.xs4all.nl

"John" <ko*****@nextlevelsw.comwrote in message
news:11**********************@i42g2000cwa.googlegr oups.com...
We have created a game and when the user click on "Download New Songs"
which requires the user to download songs.

This could be over 20 songs.
I have these files zipped on the server in one *.zip file.

Is there any c++ code, or library that could help me do the following.

Download zip file to users computer.
Unzip the file and extract the files into songs subdirectory.
Delete the zip file.

Can this be done?

Aug 19 '06 #8

This discussion thread is closed

Replies have been disabled for this discussion.