Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Linux Homework
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
v4
Comments
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
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
0 Sergey Alexandrovich Kryukov 435
1 Maciej Los 335
2 OriginalGriff 278
3 CHill60 180
4 Sinisa Hajnal 180


Advertise | Privacy | Mobile
Web03 | 2.8.141022.2 | Last Updated 24 Nov 2012
Copyright © CodeProject, 1999-2014
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