简体   繁体   中英

How to open directory using c code and download data into it

How can I open a directory that is present in the present working directory and download the images with wget into this directory. The problem is that I can successfully download the images but they get downloaded in the present working directory. How can I change directory in Linux using c code? Also, after downloading, I have to come back to the current directory.

chdir is the call you are looking for. It changes the working directory. You can change to the directory you want, download the files then change back to the current directory http://linux.die.net/man/2/chdir

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM