使用C程序回到previous目录中的Linux [英] Go back to Previous Directory in Linux using a C program

查看:132
本文介绍了使用C程序回到previous目录中的Linux的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在目录 /家庭/目的我需要回到 /家居目录。关于如何实现这一使用C程序中的任何想法?

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?

推荐答案

一个程序只能改变的它自己的环境的。因此,程序可以 CHDIR 但它不会更改父的当前目录。这就是为什么 CD 不能被实现为一个外部命令。

A program can only change its own environment. Thus, the program can chdir but it will not change the current directory of the parent. That's why cd can't be implemented as an external command.

这篇关于使用C程序回到previous目录中的Linux的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆