文件名中的"/"和"\ 0"字符 [英] '/' and '\0' characters in a filename
本文介绍了文件名中的"/"和"\ 0"字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在严格确认的外壳程序中,文件名中不能包含字符"/"和"\ 0".
在什么情况下我们可以在文件名中获得"/"?
如果以某种方式给我们一个名称中带有"/"的文件名,我们该怎么做才能摆脱它们?
请帮忙. 非常紧急
在此先感谢
In a strictly confirming shell, it''s not possible to have the characters ''/'' and ''\0'' in the file name.
Under what circumstances we would able to get ''/'' in a file name?
If we are somehow given a file name with ''/'' in its name, what we need to do to get rid of them?
Please help. very urgent
Thanks in advance
推荐答案
我不确定,但是我认为''/''可以在文件夹中打开文件!
因此,如果您有一个名为DATA的文件夹,并且想从该文件夹中打开文件
您可以在c ++中做到这一点:
I am not sure but i think the ''/'' to open a file when it is in a folder!!
So if you have a folder named DATA and you want to open a file from that folder
You can do it like that in c++:
ifstream openfile;
//...............
//Open the file which is in the folder DATA
openfile.open("DATA/filename");
//............
//Close the file
openfile.close();
您可能会在这里找到很好的解释: [ ^ ].
You may find a good explanation here: "Filenames and Pathnames in Shell: How to do it correctly"[^].
这篇关于文件名中的"/"和"\ 0"字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文