fopen() in C opens directories even if I didn't specify it

已回答

This is the line of code I used to test fopen()

I ran it and it got this

I'm confused why this code opens another folder ("cmake-build-debug") to write the text file

0

Hello!

That's because paths are relative to the environment you call your executable from (https://stackoverflow.com/a/8068942/11988753). The executable is in "cmake-build-debug" and is launched from there.

0

请先登录再写评论。