Click here to Skip to main content
15,881,248 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am trying to send a text file which is a zip file from Android to C, so while receiving i need to extract the text file. I am asking how to extract a text file that is zipped?
Posted
Updated 24-May-15 23:09pm
v2
Comments
OriginalGriff 25-May-15 4:59am    
This is not a good question - we cannot work out from that little what you are trying to do.
Remember that we can't see your screen, access your HDD, or read your mind.
So explain where you are "extracting" from, and what you want to do with it.
Some idea of what you have tried, what happened when you tried, and what help you need would be good, too.

Use the "Improve question" widget to edit your question and provide better information.
venkat28vk 25-May-15 5:10am    
Kindly look for my updated question.
venkat28vk 25-May-15 5:18am    
I am trying to send a text file from Android to C using TCP/IP Protocol. If Android is sending a text file i am able to receive the text file, but not completely(there is a loss of bytes in the received text file). So i thought of zipping the text file and sending to C, where i can extract the file.
OriginalGriff 25-May-15 5:23am    
If you are losing text, then you need to look at why - the chances are that it will also affect zip files, but that will be worse, because an incomplete ZIP doesn't generally release any information: most reading packages with just throw an exception when they find a "missing chunk" of data.

Show the code you using at both ends, and look at your data (original and received) to see if there is any pattern in what's missing. For example, is the received data always truncated to a 2K boundary or similar?
venkat28vk 25-May-15 7:25am    
Also i have tried with multiple sets of file transfer size like above 2 MB, 20 KB file, but the end result is whatever the file maybe there is some data loss happening.

1 solution

If you are loosing bytes in the communication process, I hardly see zipping it like a good solution. Anyway, the simplest way for unzipping the received file is using the linux unzip[^] command (you might run it from your application via the system[^] call).
 
Share this answer
 
Comments
venkat28vk 25-May-15 7:42am    
I have already tried with tar -xvf command in command prompt,but it is not working.Is there any possibility through the code.
CPallini 25-May-15 12:06pm    
The correct command is 'unzip'. If it doesn't work on the received file, possibly the file itself is corrupted.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900