How to get the path to the current file (pwd) in Linux from C?

前端 未结 5 1398
走了就别回头了
走了就别回头了 2021-02-09 16:30

I\'d like to know if it is somehow possible to run system("pwd") on the current DIR. So for example let\'s have this folder structure:

exam         


        
5条回答
  •  醉梦人生
    2021-02-09 16:59

    When you use system(...) call with Windows and Linux it just executes one command. It is possible to do the same using file with commands (you can create it with C code), but my oppinion is, that you should use nftw() to get dirrectories and after that use opendir()/readdir().

提交回复
热议问题