Unzip -p file opening on PIPE

Hello All,

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

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

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

  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

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'.

Thanks Jim. I tried to do the same

 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