Archived

This topic is now archived and is closed to further replies.

666_1337

chroot in windows

Recommended Posts

666_1337    122
i''ve just finished porting all my code to windows (that means, i can compile it on windows), but if i run it, it "SDL Parachute Event deploid"-Segfaults out. I figured out that on windows i cannot use fopen("foo.bar", "r") if foo.bar is in the same directory like my program. so i am now searching for a command that switches the working directory to the one containing my app. i bet you know that one...

Share this post


Link to post
Share on other sites
Leffe    301
Eh?

When you run an executable under Windows the CWD is set to the directory of the program.

A possible cause of error might be that you are using something called Microsoft Visual Crap Plus Plus Integrated Development Environment.(It''s not bad, actually) It sometimes changes the CWD.

Solution: Run the program from the commandline or explorer.

Share this post


Link to post
Share on other sites
capn_midnight    1707
If you are using Visual Studio, the program is build, then compiled to a directory called "debug" (or "release", depending on your project settings) in the project directory, which is the parent directory to the "debug" directory. However, it retains the project directory as the CWD if you run the program from the IDE. If you run the program from the command line, or explorer shell, the CWD will be the same directory as the location of the program (i.e. the right one, not the parent directory).

if you are using Borland, last I checked it did nothing like this, but of course that was 4.52 many years ago.

If you are using GCC, then I have no clue.


Do you use your powers for good or for awesome?
|My site | Association of Computing Machinery

Share this post


Link to post
Share on other sites
jamessharpe    497
Make it explicit - at the beginning of your program call SetCurrentDirectory with the location of the executable as the param. The location of the exe is one of the command line params.

James

Share this post


Link to post
Share on other sites