fopen() in C returns NULL even when file exists (is returned by readdir())

后端 未结 3 1358
囚心锁ツ
囚心锁ツ 2021-01-23 17:43

I am trying to open a directory, and then open a file named \"YouTubeSign\", directory opens fine, but for some reason fopen() on the file fails even if the file exists; any ide

3条回答
  •  猫巷女王i
    2021-01-23 18:19

    The problem is that it will work from the command line when you're testing this code. There's nothing technically missing here. You need to make sure that the process is using the correct working directory.

提交回复
热议问题