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

  • Home
  • SEARCH
  • 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 8475981
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T18:02:58+00:00 2026-06-10T18:02:58+00:00

I would like to how does C++ actually turn the command line arguments into

  • 0

I would like to how does C++ actually turn the command line arguments into a char array? What “secret” code does this? Where can I view the code that does this (even if it is in assembly, I know some assembly)? I am using Linux, if that helps.

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-10T18:03:00+00:00Added an answer on June 10, 2026 at 6:03 pm

    It’s an OS job to manage command line arguments and to put it to the stack during process creation.

    For POSIX systems the execution path is:

    1. in your program you call the execle/execve/… system call, passing the path to the new process executable and command line arguments.
    2. this data go to the kernel
    3. the kernel updates its internal structures to take the new process identity into account and allocates the address space for the new process (also kernel purges the old address space if it’s not needed anymore). the kernel initializes the process memory with zeros, copying the info from old memory to the new address space at the top of the stack.
    4. the kernel puts the new process to the scheduling queue and returns from the exec() system call, transferring execution path to the userspace and eventually to the entry point of the process (this is usually routine from crt0.o object file, which is linked by default to every executable – this routine calls main()).

    For Linux, you can see this code here:
    http://www.cs.fsu.edu/~baker/devices/lxr/http/source/linux/fs/exec.c#L383 :

    383 /*
    384  * 'copy_strings()' copies argument/environment strings from the old
    385  * processes's memory to the new process's stack.  The call to get_user_pages()
    386  * ensures the destination page is created and not swapped out.
    387  */
    

    In the do_execve() kernel counterpart of userspace execve() syscall, at line 1345, copy_strings()‘s are called, and copy_strings() routine actually does the job you’re asking about.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to know what this code does exactly. - (void)dialogDidSucceed:(FBDialog*)dialog { //[self
I would like to have a mapping function that does this: public static void
I would like to do this but it does not work. bool TryGetEnum<TEnum, TValue>(TValue
Does the latter deprecate the former? I'm writing code which I would like to
I would like to try some image filter features on iPhone like instagram does.
I would like to upload files just like google mail does. I would want
I would like to know how does the login procedure work in the Internet
I would like to ask what does it mean AttributeError: 'unicode' object has no
I would like to know how much time (in percent) does JavaScript development takes
I would like to know how Gmail (or anyone else) does comet on Opera.

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.