Unzipping a file from C++ on Redhat: alternatives to system()

后端 未结 2 1276
再見小時候
再見小時候 2021-01-23 19:00

I need to unzip a file while running a C++ program (as described in Waiting for unzip to finish before carrying on C++ code on a RedHat machine)

To do this I currently d

2条回答
  •  后悔当初
    2021-01-23 19:34

    Yep, it is bad practice for various reasons(security, portability, etc). You need to get a zipping library(a google search give me something like http://www.firstobject.com/easy-zlib-c++-xml-compression.htm or even the library used to build 'unzip' if it's free, but there must be loads out there) and then use it and if you need to do both parallelly then introduce threads. A bit work I agree, but that's better in practise than using the system() call.

提交回复
热议问题