Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8051317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T07:16:34+00:00 2026-06-05T07:16:34+00:00

I am working on MacOS-X Lion with GCC 4.2. This code works, but I

  • 0

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

#include <unistd.h>
main()
{
    char *args[] = {"/bin/ls", "-r", "-t", "-l", (char *) 0 };
    execv("/bin/ls", args);
}

warning: deprecated conversion from string constant to ‘char*’

I do not want the warning to be suppressed, I want not to have it at all.
It is C++ code, not C.

Using a char *const (so exactly the type required by execv()) still produces the warning.

Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T07:16:35+00:00Added an answer on June 5, 2026 at 7:16 am

    This seems to be ok:

    #include <unistd.h>
    main()
    {
        char const *args[] = {"/bin/ls", "-r", "-t", "-l", NULL };
        execv("/bin/ls", const_cast<char**>(args));
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There's already a working server service via socket, and I would like to test
I get this error when running on OX Lion: brew install python Error: MD5
Working on a movie website and would love to find an API that I
I want to get MySQL working with the system Python 2.7 in Mac OS
I'm working on a C++ cross-platform OpenGL application (Windows, Linux and MacOS) and I
I am working on MacOSX Lion, and I am trying to install Zend Framework.
I'm working on an Objective-C app that is Mac OS X Lion only. I'm
I would like to use pipes to redirect stdin and stdout of a child
I'm working on Mac OS X 10.7.2 with Growl 1.3.1 for Lion. I installed
I'm trying to get Heroku toolbelt working and it's a total nightmare. The install

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.