PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.ruby > Input using stdin
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Input using stdin

Réponse
 
LinkBack Outils de la discussion
Vieux 12/03/2008, 08h03   #1
Nikhil Warade
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Input using stdin

How can I give input to a program using STDIN
Suppose I want the program to take the value x=10
On some other site i found it as STDIN.read,but its not working.
--
Posted via http://www.ruby-forum.com/.

  Réponse avec citation
Vieux 12/03/2008, 08h23   #2
Friedrich Dominicus
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Input using stdin

Nikhil Warade <newarade47@gmail.com> writes:

> How can I give input to a program using STDIN
> Suppose I want the program to take the value x=10
> On some other site i found it as STDIN.read,but its not working.
>


print("Give me a string ");
STDOUT.flush
a_string = gets
print("You gave me '#{a_string}'")

Regards
Friedrich

--
Please remove just-for-news- to reply via e-mail.
  Réponse avec citation
Vieux 12/03/2008, 08h37   #3
Nikhil Warade
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Input using stdin

Friedrich Dominicus wrote:
> Nikhil Warade <newarade47@gmail.com> writes:
>
>> How can I give input to a program using STDIN
>> Suppose I want the program to take the value x=10
>> On some other site i found it as STDIN.read,but its not working.
>>

>
> print("Give me a string ");
> STDOUT.flush
> a_string = gets
> print("You gave me '#{a_string}'")
>
> Regards
> Friedrich


Please check http://codegolf.com/reverse where we need to input using
STDIN
You don't seem to have used STDIN
--
Posted via http://www.ruby-forum.com/.

  Réponse avec citation
Vieux 12/03/2008, 09h05   #4
Friedrich Dominicus
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Input using stdin

Nikhil Warade <newarade47@gmail.com> writes:

> Friedrich Dominicus wrote:
>> Nikhil Warade <newarade47@gmail.com> writes:
>>
>>> How can I give input to a program using STDIN
>>> Suppose I want the program to take the value x=10
>>> On some other site i found it as STDIN.read,but its not working.
>>>

>>
>> print("Give me a string ");
>> STDOUT.flush
>> a_string = gets
>> print("You gave me '#{a_string}'")
>>
>> Regards
>> Friedrich

>
> Please check http://codegolf.com/reverse where we need to input using
> STDIN
> You don't seem to have used STDIN

gets works on the standard input if you insist you can write
STDIN.gets if that makes you feel better


STDIN.public_methods.sort
=> ["<<", "==", "===", "=~", "__id__", "__send__", "all?", "any?",
"binmode", "class", "clone", "close", "close_read", "close_write",
"closed?", "collect", "detect", "display", "dup", "each", "each_byte",
"each_line", "each_with_index", "entries", "eof", "eof?", "eql?",
"equal?", "extend", "fcntl", "fileno", "find", "find_all", "flush",
"freeze", "frozen?", "fsync", "getc", "gets",
^^^^^^ here is your gets

Friedrich

--
Please remove just-for-news- to reply via e-mail.
  Réponse avec citation
Vieux 12/03/2008, 09h11   #5
Phillip Gawlowski
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Input using stdin

Nikhil Warade wrote:
> STDIN
> You don't seem to have used STDIN
>
> Please check http://codegolf.com/reverse where we need to input using

http://en.wikipedia.org/wiki/Standar...ut_.28stdin.29

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 03h46.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,10316 seconds with 13 queries