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

How to access/print a command response with multiple lines? #27

Open
alexe100 opened this issue Feb 19, 2019 · 2 comments
Open

How to access/print a command response with multiple lines? #27

alexe100 opened this issue Feb 19, 2019 · 2 comments

Comments

@alexe100
Copy link

I am executing a ps command and multiple lines are return. Why I am just see the first one?
...
auto res = cut.communicate().first;
std::cout << res.buf.data() << std::endl;

Please, how to iterate the res variable?

Thanks

@arun11299
Copy link
Owner

Sorry, I did not see this.
Will get back to you by EOD today.

@arun11299
Copy link
Owner

I am running this in my Mac:

auto p = Popen({"ps"}, output{PIPE});
auto obuf = p.communicate().first;
std::cout << "Data : " << obuf.buf.data() << std::endl;

It gives me the entire output.

Can you please tell about the details of your platform and share the entire code ?

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

2 participants