Mombu the Programming Forum

Go Back   Mombu the Programming Forum > Programming > Download, Zip, and extract
User Name
Password
REGISTER NOW! Mark Forums Read




Reply
1 26th October 13:48
john
External User
 
Posts: 1
Default Download, Zip, and extract



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?
  Reply With Quote


 


2 26th October 13:49
phlip
External User
 
Posts: 1
Default Download, Zip, and extract



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


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!!!
  Reply With Quote
3 26th October 13:49
bigbrian
External User
 
Posts: 1
Default Download, Zip, and extract


following.

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
  Reply With Quote
4 30th October 14:31
bigbrian
External User
 
Posts: 1
Default Download, Zip, and extract


Where did the OP state MP3 is the format? I must have missed that.
There are may audio formats other than MP3.

-Brian
  Reply With Quote
5 30th October 14:31
jerry coffin
External User
 
Posts: 1
Default Download, Zip, and extract


In article <1155956172.084655.99930@m79g2000cwm.googlegroups. com>,
work@brianmielke.com says...

[ ... ]

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.
  Reply With Quote
6 30th October 14:32
phlip
External User
 
Posts: 1
Default Download, Zip, and extract


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!!!
  Reply With Quote
7 30th October 14:32
jim langston
External User
 
Posts: 1
Default Download, Zip, and extract


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.
  Reply With Quote
8 30th October 14:32
moonlit
External User
 
Posts: 1
Default OT:Re: Download, Zip, and extract


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
  Reply With Quote
Reply


Thread Tools
Display Modes




666