|
-
Dec 7th, 2002, 11:05 AM
#1
Thread Starter
Fanatic Member
Getting directory from a path
Hi,
I have wrote a class that opens a file and reads information out of it, and i have the following function..
Code:
model.LoadModel("data\\file.txt");
How can i determine the directory that file is in, is current applications path and \data\ " ?
The reason is the file.txt contains a reference to another file, which is stored in the same path as file.txt. But i dont know how to code to find out what that directory is.
Thanks.
-
Dec 7th, 2002, 06:52 PM
#2
Lively Member
Try searching for _splitpath on MSDN.
-
Dec 8th, 2002, 06:20 AM
#3
On windows you can use _getcwd to get the current working directory, to which all relative paths relate.
There's a similar POSIX function.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Dec 8th, 2002, 09:08 AM
#4
Thread Starter
Fanatic Member
Thanks for your replies, helped me alot
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|