On 10/6/20 8:12 PM, Arjen Markus wrote:
Hello,

I have run into a problem with the functions getcwd() and chdir() used via
the GCC compiler under MinGW. I try to use the directory "/home" (well,
just an example):
ls /home
cd /home
give no problem, but chdir("/home") in a C program fails. I used getcwd()
to see what the actual directory name is if the program is started in the
directory that is reached via "cd /home". To my surprise it is:
"c:\<msys-install-directory>\home", so a Windows-style directory.
How can I use the Linux-style directories in a program of my own?

Kind regards,

Arjen


You can't. The /home directory is not real, but emulated by MSYS, calls to msvcrt getcwd() and chdir() via MinGW will not be emulated.

Those shell commands are not using MinGW, they are using the MSYS runtime.

You should use Cygwin, it fits your requirements better, as it comes with its own C runtime for emulating *nix.

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to