Getting a file path in C++

Associate
Joined
22 Nov 2005
Posts
319
Location
Alnwick, Northumberland
I have a multimedia class in which i pass in a string to the constructor, which is just the file name eg "mediaexample.avi".

Is there anyway i can get the full path name instead of hardcoding it?
GetCurrentDirectory and GetFullPathName are no good at all, because the media files are not in the current working directory, they are in C:/Windows/Media.

Any help is appreciated.

Laurio
 
if you are only passing the file name in to the class then it has no way of guessing where it might be on the hard drive. You could always extend the class to have a constructor that took two strings as parameters the file's name and location. That way you could remove the hard codedness easily

Paul
 
Back
Top Bottom