Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Contributor
tnavabothu
Posts: 48
Registered: ‎08-07-2013
My Device: z10
My Carrier: blackberry

zip and unzip .txt files

hi,

 

     i want to know how zip and unzip functionalities,i'm having five text files,when the user clicks on a button thse five textfiles has to be zipped,when the user clicks on another button,these files has to be unzip.

 

thanks in advance

Please use plain text.
Developer
simon_hain
Posts: 16,095
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: zip and unzip .txt files

[ Edited ]

edit: see below

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
Developer
BBSJdev
Posts: 6,094
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: zip and unzip .txt files

Apart from the ones built in of course... :smileyhappy:

 

http://developer.blackberry.com/native/documentation/core/library_support_at_a_glance.html

 

libbz2 and libz


If you've been helped click on Like Button, if you've been saved buy the app. :smileyhappy:

Developer of stokLocker, Sympatico and Super Sentences.
Please use plain text.
Contributor
tnavabothu
Posts: 48
Registered: ‎08-07-2013
My Device: z10
My Carrier: blackberry

Re: zip and unzip .txt files

hi,

 

    thanks for the reply,i want to generate a zip file with extention .zip file,can any one know how to do it.

Please use plain text.
Developer
simon_hain
Posts: 16,095
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: zip and unzip .txt files

QFile offers a simple api to generate and write to a file.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
Contributor
tnavabothu
Posts: 48
Registered: ‎08-07-2013
My Device: z10
My Carrier: blackberry

Re: zip and unzip .txt files

can u please elaborate this,right now i'm creating a set of files with some content by using QFile, now i need to zip these files with .zip extention
Please use plain text.
Developer
simon_hain
Posts: 16,095
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: zip and unzip .txt files

i didn't check the APIs of the zip libraries, but usually you put some QBytes in a method and get some QBytes out (which represent the zipped content).
Create a file with the same name and the zip extension and write the QBytes in it.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
Contributor
tnavabothu
Posts: 48
Registered: ‎08-07-2013
My Device: z10
My Carrier: blackberry

Re: zip and unzip .txt files

hi,

 

    i found a resource at http://stackoverflow.com/questions/13373269/add-library-into-cascades which uses QuaZIP wrapper.i implemented this to my code everything works fine,but it is not generating or extracting the .zip file,but the function call returns true.

 

Please use plain text.
Developer
dkonigs
Posts: 248
Registered: ‎07-25-2008
My Device: Bold 9900

Re: zip and unzip .txt files

Um, no need to go off-track in so many different directions when there's no need.

 

BB10 includes libarchive, which is a library that can be used to read and write actual ZIP files.

 

With a little bit of web searching, it shouldn't be too hard to find some code examples for how to use libarchive.

Please use plain text.
Contributor
tnavabothu
Posts: 48
Registered: ‎08-07-2013
My Device: z10
My Carrier: blackberry

Re: zip and unzip .txt files

thank u guys,

 

        i get my job done.thanks for directing me

Please use plain text.