Click here to Skip to main content
11,790,904 members (67,754 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: Linux
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
Posted 23-Nov-12 0:32am
Edited 23-Nov-12 5:50am
Andy411 at 23-Nov-12 8:22am
I deleted my solution, because it was not the correct answer to your question.
Where did you get the filename from? I mean, are you sure that the string before the / is not a part of the directory?
srmohanr at 23-Nov-12 8:24am
Yeah, it's not a directory. And I forgot the path where I saw. Others wise it will be more clear.
Richard MacCutchan at 23-Nov-12 11:49am
This is not urgent, it is just more of your homework. Same advice as before: go and read your study guides.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

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"DATA/filename");
//Close the file
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

You may find a good explanation here: "Filenames and Pathnames in Shell: How to do it correctly"[^].

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 410
1 ppolymorphe 385
2 Richard MacCutchan 118
3 Jochen Arndt 80
4 Maciej Los 70
0 OriginalGriff 1,329
1 Maciej Los 835
2 ppolymorphe 780
3 KrunalRohit 686
4 CPallini 661

Advertise | Privacy | Mobile
Web02 | 2.8.1509028.1 | Last Updated 24 Nov 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100