digitalmars.D - int input
- Rayne (1/1) Sep 09 2008 I was wondering, since you can't cast readln, how would you get int inpu...
- Chris R. Miller (9/10) Sep 09 2008 ut from the user? I know this is a newbish question, but yeah I'm not su...
- Rayne (2/15) Sep 09 2008 I found std.conv but this brings me to another problem, whenever it trys...
- Denis Koroskin (4/7) Sep 10 2008 Maybe you need this:
- Rayne (2/12) Sep 10 2008 That doesnt work.
- Steven Schveighoffer (6/8) Sep 10 2008 use din from std.cstream:
- Rayne (2/15) Sep 10 2008 Awesome, thanks bro, I never thought to look in that namespace x_x.
- Steven Schveighoffer (7/23) Sep 10 2008 yw :)
I was wondering, since you can't cast readln, how would you get int input from the user? I know this is a newbish question, but yeah I'm not sure.
Sep 09 2008
Rayne wrote:I was wondering, since you can't cast readln, how would you get int inp=ut from the user? I know this is a newbish question, but yeah I'm not sur= e. To parse? In tango it's in a parser in tango.text.convert.Integer and Float. I don't use Phobos, so if that's the library you're using I'm sorry but I can't help (there should be an importable parser...) Which gave me another idea, but I'll start it in a different thread so as to not hijack yours.
Sep 09 2008
Chris R. Miller Wrote:Rayne wrote:I found std.conv but this brings me to another problem, whenever it trys to convert it says Error: conversion 1 and closes the console window, anyone know whats wrong here?I was wondering, since you can't cast readln, how would you get int input from the user? I know this is a newbish question, but yeah I'm not sure.To parse? In tango it's in a parser in tango.text.convert.Integer and Float. I don't use Phobos, so if that's the library you're using I'm sorry but I can't help (there should be an importable parser...) Which gave me another idea, but I'll start it in a different thread so as to not hijack yours.
Sep 09 2008
On Wed, 10 Sep 2008 08:09:00 +0400, Rayne <DiscipleRayne gmail.com> wrote:I was wondering, since you can't cast readln, how would you get int input from the user? I know this is a newbish question, but yeah I'm not sure.Maybe you need this: int i; read(i); // read an integer from console
Sep 10 2008
Denis Koroskin Wrote:On Wed, 10 Sep 2008 08:09:00 +0400, Rayne <DiscipleRayne gmail.com> wrote:That doesnt work.I was wondering, since you can't cast readln, how would you get int input from the user? I know this is a newbish question, but yeah I'm not sure.Maybe you need this: int i; read(i); // read an integer from console
Sep 10 2008
"Rayne" wroteI was wondering, since you can't cast readln, how would you get int input from the user? I know this is a newbish question, but yeah I'm not sure.use din from std.cstream: din.read(myint); -or- din.readf("%d", &myint); -Steve
Sep 10 2008
Steven Schveighoffer Wrote:"Rayne" wroteAwesome, thanks bro, I never thought to look in that namespace x_x.I was wondering, since you can't cast readln, how would you get int input from the user? I know this is a newbish question, but yeah I'm not sure.use din from std.cstream: din.read(myint); -or- din.readf("%d", &myint); -Steve
Sep 10 2008
"Rayne" wroteSteven Schveighoffer Wrote:yw :) Yeah, I didn't think to look for it their either, I ended up doing a grep for "readf" in order to find it the first time (which is in std.stream I think), then I don't remember how I figured out to look for din :) Of course, I don't generally use Phobos... -Steve"Rayne" wroteAwesome, thanks bro, I never thought to look in that namespace x_x.I was wondering, since you can't cast readln, how would you get int input from the user? I know this is a newbish question, but yeah I'm not sure.use din from std.cstream: din.read(myint); -or- din.readf("%d", &myint); -Steve
Sep 10 2008