Reputation: 1 Apprentice
- Active Posts:
- 26 (0.16 per day)
- 11-December 12
- Profile Views:
- Last Active:
- Apr 12 2013 09:14 AM
- Dream Kudos:
Posts I've Made
Posted 25 Feb 2013It really doesn't matter why I'm passing and returning a string, it's the concept I'm trying to understand.
In my book it does matter, because C/C++ may not be the best language for the situation. Myself, I would use the shell unless absolutely necessary, because system is going to return true, pretty much always. It does not return the shell output. You need to capture it another way, & that's a lot of run-around when you can do it right at the shell & pipe, or redirect it's output.
You very well may be getting the output, after all we have no code to go on to help you further troubleshoot the issue. The situation maybe that you are not getting the output you expect, so you think it isn't working.
I didn't give you any more than I did because I wanted a specific answer.
I'm not looking for the simplest solution either.
I only have C++ in this case thats it..
I'm not troubleshooting. I'm asking a direct question.
Skydiver answered it in one so I'm not sure what the issue is.
Posted 25 Feb 2013Thank you Skydiver.
That gives me something to look up.
I'll certainly look at what you have suggested.
Posted 25 Feb 2013Lets say for example, I input a string into Foo.exe and it outputs that string backwards.
It's a useless program but I just want to know how to pass an argument when calling a executable binary.
Posted 25 Feb 2013This isn't advanced C/C++ discussion, moving to C/C++.
Why are you setting a variable to a string value, & then just passing that string verbatim anyway?
As for your question, the first thing thing I would ask is the path to 'foo.exe' correct? How have you determined it is the argument that isn't being passed & not the system call to the exe that is failing?
Thanks for moving the post. I pondered where to put it for a while.
It really doesn't matter why I'm passing and returning a string, it's the concept I'm trying to understand. The path to
foo.exe is correct in the examples I tried and I did use the path. So it was an error on my behalf not displaying the path to foo.exe.
Let me generalize the question.
Do you know how to pass arguments using system()?
//is it system("c:\\Documents\\foo.exe argument");
if it is then I may have something wrong with my code but I'm having trouble having foo.exe respond with
anything but a garbage value.
Posted 1 Jan 2013Thanks, that explain it well.
- Member Title:
- New D.I.C Head
- Age Unknown
- Birthday Unknown
tomadom hasn't added any friends yet.