Click here to Skip to main content
12,946,816 members (48,255 online)
Rate this:
 
Please Sign up or sign in to vote.
See more:
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
srmohanr1.2K
Updated 23-Nov-12 5:50am
v4
Comments
Andy411 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 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 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
 
good
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
openfile.open("DATA/filename");
 
//............
//Close the file
openfile.close();
  Permalink  
Rate this: bad
 
good
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"[^].
  Permalink  

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

    Print Answers RSS
Top Experts
Last 24hrsThis month
OriginalGriff 5,059
CHill60 3,235
Maciej Los 2,538
Jochen Arndt 1,935
ppolymorphe 1,795


Advertise | Privacy | Mobile
Web01 | 2.8.170518.1 | Last Updated 24 Nov 2012
Copyright © CodeProject, 1999-2017
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