String cast error
Justin Whear via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Jun 18 17:10:34 PDT 2014
On Thu, 19 Jun 2014 00:05:36 +0000, SomeRiz wrote:
> Hi.
>
> My code running:
>
> http://dpaste.dzfl.pl/2183586524df
>
> Output:
>
> SerialNumber 927160020XXXX (X = Some Numbers)
>
> How do I delete "SerialNumber" text?
>
> Example
>
> string SomeRiz = system(a);
>
> I get an error:
>
> b.d(10): Error: cannot implicitly convert expression (system(a))
> of type int to string
>
> Later;
>
> string SomeRiz = cast(string)system(a);
>
> I get an error 2:
>
> b.d(10): Error: cannot cast system(a) of type int to string
>
>
> How do I delete "SerialNumber" text?
>
> I just, want to see the numbers:
>
> 927160020XXXX
>
> Sorry for my bad english
The problem is that `system` returns the process exit code (an integer),
not the output of the process. Try using std.process.execute or
std.process.executeShell.
More information about the Digitalmars-d-learn
mailing list