目录结构的C ++ [英] directory structures C++

查看:226
本文介绍了目录结构的C ++的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

C:\Projects\Logs\RTC\MNH\Debug  
C:\Projects\Logs\FF

有一个前pression /字符串,它会说回去,直到找到日志,并打开它? (假设你总是在它下面)

Is there an expression/string that would say go back until you find "Logs" and open it? (assuming you were always below it)

同一个可执行文件运行了调试,MNH或FF在不同的时间,可执行始终应该将其保存的日志文件到日志。

The same executable is run out of "Debug", "MNH" or "FF" at different times, the executable always should save it's log files into "Logs".

什么EX pression会到达那里而不涉及整个路径C:\项目\日志

What expression would get there WITHOUT referring to the entire path C:\Projects\Logs?

感谢。

推荐答案

这听起来像你问的相对路径。

It sounds like you're asking about a relative path.

如果工作目录是 C:\项目\日志\ RTC \ MNH \调试\ ,路径 .. \ .. \。 \文件重presents在日志目录中的文件。

If the working directory is C:\Projects\Logs\RTC\MNH\Debug\, the path ..\..\..\file represents a file in the Logs directory.

如果你可以在任 C:\项目\日志\ RTC \ MNH \ C:\项目\日志\ RTC \ MNH \调试\ ,再没有任何一个EX pression将让你回到日志从任何地方。你可以尝试检查 .. \ .. \ .. \ ..存在\日志,如果不存在,请尝试。 \ .. \ .. \日志 .. \ .. \日志 .. \日志,其中存在会告诉你,你是如何深,多少 .. ,则必须让你回到日志

If you might be in either C:\Projects\Logs\RTC\MNH\ or C:\Projects\Logs\RTC\MNH\Debug\, then no single expression will get you back to Logs from either place. You could try checking for the existence of ..\..\..\..\Logs and if that doesn't exist, try ..\..\..\Logs, ..\..\Logs and ..\Logs, which one exists would tell you how "deep" you are and how many ..s are required to get you back to Logs.

这篇关于目录结构的C ++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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