Unzip -p file opening on PIPE


 
Thread Tools Search this Thread
Top Forums Programming Unzip -p file opening on PIPE
# 1  
Old 02-25-2015
Unzip -p file opening on PIPE

Hello All,

Below is how I am reading the file and the problem I am facing


Code:
 FILE* zipinputFile = ::popen(m_strZipFile, "r");

here my m_strZipFile = 999_zpd.zip so my open will be as below

Code:
  FILE* zipinputFile = ::popen(unzip -p '999_zpd.zip',"r");

if someone delete the file from NAS unzip is showing the error as "error: zipfile read error" but I cannot get the erro rin peopn because it is a file pointer. Is there any way to expedite this

Thanks,
Arun

Last edited by arunkumar_mca; 02-25-2015 at 08:08 AM..
# 2  
Old 02-25-2015
ferror(zipinputfile) will show an error after read.

This is a problem with some kinds of network mounted file systems. If the file system were a true local device, the OS would remove the directory entry, but leave the physical file untouched until all processes that have the file open have exited.

The file is actually mounted somewhere else. So it immediately gets clobbered when somebody says 'delete'.
# 3  
Old 02-25-2015
Thanks Jim. I tried to do the same

Code:
 cout << ferror(zipinputFile) <<  endl;

got 0 as output for sucess and failure case

Sucess :

run the source and didnt delete the file while the program is running - got 0 as ferror state

Failure :

run the source and delete the file while the program is running - got 0 as ferror state
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Unzip a gz file

Please tell me the unix command how to unzip a gz file(say a qwe.gz) and the orginal gz file should remain intact. Thanks in advance (7 Replies)
Discussion started by: pranabpal
7 Replies

2. Shell Programming and Scripting

Unzip the .zip file without using unzip utility in UNIX

I have .zip file, i want to list all the files archived in the zip file. unzip utility is not working for me in unix. Please help me resolve this issue Thanks ganesh. (3 Replies)
Discussion started by: Ganesh L
3 Replies

3. Shell Programming and Scripting

How to ignore Pipe in Pipe delimited file?

Hi guys, I need to know how i can ignore Pipe '|' if Pipe is coming as a column in Pipe delimited file for eg: file 1: xx|yy|"xyz|zzz"|zzz|12... using below awk command awk 'BEGIN {FS=OFS="|" } print $3 i would get xyz But i want as : xyz|zzz to consider as whole column... (13 Replies)
Discussion started by: rohit_shinez
13 Replies

4. UNIX for Dummies Questions & Answers

Unzip a .rar file

Hi, How to unzip a .rar file in unix. I tried unrar command but it doesnt work. Any help will be appreciated Thanks (10 Replies)
Discussion started by: irudayaraj
10 Replies

5. UNIX for Dummies Questions & Answers

unzip single file in zip file to STDOUT

Hi, Does anyone know if there is an unzip command similar to tar -xOf $tarBall $fileInTarFile which will untar a single file in a tar ball to STDOUT ? I want to do the same but with a .zip (ZIP archive) file. - Andy ---------- Post updated at 05:56 PM ---------- Previous update... (0 Replies)
Discussion started by: andyatit
0 Replies

6. Shell Programming and Scripting

How to Unzip a file using unzip utility for files zipped without zip utility ?

Hi, I need to zip/compress a data file and send to a vendor. The vendor does have only unzip utility and can accept only .ZIP files. I do not have zip utility in my server. How do I zip/compress the file so that it can be deflated using unzip command ? I tried gzip & compress commands, but... (1 Reply)
Discussion started by: Sabari Nath S
1 Replies

7. Shell Programming and Scripting

How to unzip the file

Hi, I have a file in the form of .zip in unix directory, now I want to unzip the file in unix environment. May I know how to unzip this file File name: cust.zip Thanks in Advance... Aswice (1 Reply)
Discussion started by: aswice
1 Replies

8. Shell Programming and Scripting

How to Unzip a .ZIP file in Unix without using unzip cmd..?????

Hi All I have ftped a .ZIP file (zipped using WinZip in Windows) to my Unix server (HP-UX). I don't have unzip cmd available in my curent Unix version Please let me know any cmd in UNIX (other than unzip) using which I can unzip this .ZIP file . Please elaborate on the commands aval and... (5 Replies)
Discussion started by: sureshg_sampat
5 Replies

9. HP-UX

How to Unzip a .ZIP file in Unix without using unzip cmd..?????

Hi All I have ftped a .ZIP file (zipped using WinZip in Windows) to my Unix server (HP-UX). I don't have unzip cmd available in my curent Unix version Please let me know any cmd in UNIX (other than unzip) using which I can unzip this .ZIP file . Please elaborate on the commands aval and... (5 Replies)
Discussion started by: sureshg_sampat
5 Replies

10. UNIX for Advanced & Expert Users

How to unzip a .zip file when

there is no unzip package present. (2 Replies)
Discussion started by: yogesh_powar
2 Replies
Login or Register to Ask a Question