Go back to Previous Directory in Linux using a C program

后端 未结 3 1542
不知归路
不知归路 2021-01-24 18:38

I am in the directory /home/destination I need to go back to the /home directory. Any ideas on how to implement this using a C-program?

3条回答
  •  春和景丽
    2021-01-24 19:21

    You can use the chdir function for this:

    chdir(".."); /* change current working directory, go one level up */
    

提交回复
热议问题