March 30, 2005 C's sscanf in D? | ||||
|---|---|---|---|---|
| ||||
Tried several combinations, and searched for examples but I don't seem to be able to get something like C's
// 59:58 Kill: 0 3 8: pezen killed AEon by MOD_PLASMA
sscanf(line,"Kill: %d %d %d: ",&pl1,&pl2,&mod);
done in D.
I tried vscanf, but the command does not even seem to exist?
-> //aepar.d(21): undefined identifier vscanf
I tested scanf:
char[] line = " 59:58 Kill: 0 3 8: pezen killed AEon by MOD_PLASMA";
int a,b,c;
scanf(line, "Kill: %d %d %d: ",a,b,c);
writefln("59:58 Kill: 0 3 8: (",a,") (",b,")(",c,")");
but that seems to wait for a keyboard input.
Any help appreciated.
AEon
| ||||
March 30, 2005 Re: C's sscanf in D? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to AEon | AEon wrote: > Tried several combinations, and searched for examples but I don't seem to be able to get something like C's > > // 59:58 Kill: 0 3 8: pezen killed AEon by MOD_PLASMA > sscanf(line,"Kill: %d %d %d: ",&pl1,&pl2,&mod); > > done in D. You need to: a) use sscanf, like above b) wait for "readf" (coming soon) std.string.unformat(line,"Kill: %d %d %d: ",&pl1,&pl2,&mod); // soon --anders | |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply