How to use execv() without warnings?

前端 未结 6 1840
半阙折子戏
半阙折子戏 2021-01-03 07:46

I am working on MacOS-X Lion with GCC 4.2. This code works, but I get a warning I would like fix:

#include 
main()
{
    char *args[] = {\"/b         


        
6条回答
  •  轮回少年
    2021-01-03 08:35

    This seems to be ok:

    #include 
    main()
    {
        char const *args[] = {"/bin/ls", "-r", "-t", "-l", NULL };
        execv("/bin/ls", const_cast(args));
    }
    

提交回复
热议问题