digitalmars.D.learn - User input
- Namal (2/2) Nov 08 2017 Is there any other way to do a simple user input into integer
- =?UTF-8?Q?Ali_=c3=87ehreli?= (15/17) Nov 08 2017 import std.stdio;
Is there any other way to do a simple user input into integer variables without using std.conv?
Nov 08 2017
On 11/08/2017 09:19 AM, Namal wrote:Is there any other way to do a simple user input into integer variables without using std.conv?import std.stdio; void main() { int i; readf(" %s", &i); // You can use %d as well // You can wrap readf in a function template for a more natural use: int j = read!int(); } T read(T)() { T value; readf(" %s", &value); return value; } Ali
Nov 08 2017