String cast error
Ali Çehreli via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Jun 18 18:52:41 PDT 2014
On 06/18/2014 06:04 PM, SomeRiz wrote:
> Thanks Teoh
>
> I'm trying compile but i get an error:
>
> b.d(22): Error: function b.extractSerial (string input) is not callable
> using ar
> gument types (ProcessOutput)
According to its documentation, executeShell() returns a Tuple
consisting of the return status and the output of the executed program:
http://dlang.org/library/std/process/executeShell.html
Do not print the entire returned Tuple. Instead, print just the .status
member of it:
auto result = executeShell(a);
if (result.status == 0) {
// It worked! Now we can get the output:
auto output = result.output;
// Use 'output' here...
}
So, 'output' above is what you should pass to extractSerial() function
that H. S. Teoh has written:
assert(extractSerial(output) == "92716002xxxx");
(I have not tested the code above.)
Ali
More information about the Digitalmars-d-learn
mailing list