Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MacOS] getCommandLineArgs needs to be tested #9

Open
dzharii opened this issue Dec 4, 2022 · 0 comments
Open

[MacOS] getCommandLineArgs needs to be tested #9

dzharii opened this issue Dec 4, 2022 · 0 comments

Comments

@dzharii
Copy link
Owner

dzharii commented Dec 4, 2022

  std::vector<std::string> getCommandLineArgs(void)
  {
    pid_t pid = getpid();
    std::vector<std::string> args;
    std::string filename = "/proc/" + std::to_string(pid) + "/cmdline";
    std::ifstream file(filename);
    if (file.is_open())
    {
        std::string arg;
        while (std::getline(file, arg, '\0'))
        {
            args.push_back(arg);
        }
    }
    return args;
  }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant