Download, Zip, and extract

J

John

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?
 
P

Phlip

John said:
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.
 
B

BigBrian

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
 
B

BigBrian

Phlip said:
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
 
J

Jerry Coffin

[ ... ]
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.
 
P

Phlip

BigBrian said:
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.
 
J

Jim Langston

John said:
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.
 
M

Moonlit

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top