Sometimes _getcwd()
returns the parent direcory of the current one, other times returns the folder of the current user.. Has it ever happened to you-all? Thanks in advance
ulisse0
0
Newbie Poster
Recommended Answers
Jump to PostI suspect that you are changing the current working directory without realising it. Try experimenting a bit to see what it is you are doing before you call _getcwd() which might be changing it.
Jump to PostThank you for your reply. The call to _getcwd is at the very beginnning of the main():
Fair enough.
How are you invoking the program? The cwd is not necessarily the directory containing the executable, so if you invoke it in different ways this may affect the cwd …
Jump to PostYou could try ::GetCurrentDirectory() and see if it behaves differently, though I doubt it.
If you are actually interested in the directory in which the executable is installed, as opposed to the current working directory, then _getcwd() is not what you want anyway. In this case you will get the …
All 10 Replies
MrSpigot
64
Junior Poster
ulisse0
0
Newbie Poster
MrSpigot
64
Junior Poster
ulisse0
0
Newbie Poster
MrSpigot
64
Junior Poster
WaltP
2,905
Posting Sage w/ dash of thyme
Team Colleague
ArkM
1,090
Postaholic
ulisse0
0
Newbie Poster
ulisse0
0
Newbie Poster
ArkM
1,090
Postaholic
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.