www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - User input

reply Namal <sotis22 mail.ru> writes:
Is there any other way to do a simple user input into integer 
variables without using std.conv?
Nov 08 2017
parent =?UTF-8?Q?Ali_=c3=87ehreli?= <acehreli yahoo.com> writes:
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