Click here to Skip to main content
15,888,802 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am implementing the interface IInitializeWithStream.
Ovw here I am able to retrieve only a file name through it's function Initialize().
Where as I require the absolute path of the file for further processing. Is there any way we can retrieve this
Posted

1 solution

An IStream is often a FileStream and filestream have file path.

But not all IStream are files.
I am not sure what language you use but typically you'd have to check for the type.

C#
if (stream is FileStream) filename = ((FileStream)stream).Name;
 
Share this answer
 
Comments
TinDude 25-Jun-12 11:35am    
I am using C++.
((FileStream)stream).Name; gives me just the name of the file. I am looking for the complete path of the file

Pascal Ganaye 25-Jun-12 15:25pm    
The c++ IStream has no method for filepath.
Some person have managed to get to the path using the file handle but this is nasty.
http://forums.codeguru.com/archive/index.php/t-309750.html
Sergey Alexandrovich Kryukov 16-Nov-12 22:34pm    
Good point, a 5.
--SA

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