Click here to Skip to main content
15,892,161 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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
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.

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++:
C++
ifstream openfile;

//...............
//Open the file which is in the folder DATA
openfile.open("DATA/filename");

//............
//Close the file
openfile.close();
 
Share this answer
 
You may find a good explanation here: "Filenames and Pathnames in Shell: How to do it correctly"[^].
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900