Click here to Skip to main content
11,577,258 members (59,338 online)
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
srmohanr1.2K
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 DamithSL 155
1 Afzaal Ahmad Zeeshan 125
2 OriginalGriff 115
3 Richard MacCutchan 100
4 Abhinav S 90
0 OriginalGriff 820
1 Sergey Alexandrovich Kryukov 631
2 Abhinav S 528
3 F-ES Sitecore 420
4 Suvendu Shekhar Giri 365


Advertise | Privacy | Mobile
Web04 | 2.8.150603.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