[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Newby>> Ruby and method Gets... and Windows

Alex

4/2/2006 9:25:00 PM

Hi,

i'm under Windows XP SP2 and i installed OneClick Installer. So, i began to
read some documentations and i learnt to use the gets's method.

So nothing hard in that, i wrote my program in SciTE:

puts "Hi what's your name?"
nom = gets
puts "OK Hi " + nom

But it don't work. A windows with "c:\ruby\bin\ruby.exe" in the titlebar
appear but i can't write anything in it. Nothing. So i close the windows and
in SciTE i have it:
Exit code: -1073741510

Can you help me please? And please, don't tell me i have to work under Linux
;o)

Thanks

Alex


5 Answers

Jeppe Jakobsen

4/2/2006 9:56:00 PM

0

Well don't worry you don't have to switch to Linux.
When running programs which use "gets", you have to use your command line.

2006/4/2, Alex <alex@alex.xom>:
>
> Hi,
>
> i'm under Windows XP SP2 and i installed OneClick Installer. So, i began
> to
> read some documentations and i learnt to use the gets's method.
>
> So nothing hard in that, i wrote my program in SciTE:
>
> puts "Hi what's your name?"
> nom = gets
> puts "OK Hi " + nom
>
> But it don't work. A windows with "c:\ruby\bin\ruby.exe" in the titlebar
> appear but i can't write anything in it. Nothing. So i close the windows
> and
> in SciTE i have it:
> Exit code: -1073741510
>
> Can you help me please? And please, don't tell me i have to work under
> Linux
> ;o)
>
> Thanks
>
> Alex
>
>
>
>


--
"winners never quit, quitters never win"

William James

4/2/2006 11:03:00 PM

0

Alex wrote:
> Hi,
>
> i'm under Windows XP SP2 and i installed OneClick Installer. So, i began to
> read some documentations and i learnt to use the gets's method.
>
> So nothing hard in that, i wrote my program in SciTE:

Don't use SciTE. It isn't part of Ruby. Use your favorite text
editor (even Notepad). Save the program as "name.rb" and run it
from the DOS prompt with

ruby name.rb

(To open a DOS prompt, click on
Start / Programs / Accessories / Command prompt.)

>
> puts "Hi what's your name?"
> nom = gets
> puts "OK Hi " + nom
>
> But it don't work. A windows with "c:\ruby\bin\ruby.exe" in the titlebar
> appear but i can't write anything in it. Nothing. So i close the windows and
> in SciTE i have it:
> Exit code: -1073741510
>
> Can you help me please? And please, don't tell me i have to work under Linux
> ;o)
>
> Thanks
>
> Alex

Derek Perrault

4/2/2006 11:14:00 PM

0

Or you can still use SciTE to get the syntax coloring, but follow William's
advice by only running your scripts in DOS.

On 4/2/06, William James <w_a_x_man@yahoo.com> wrote:
>
> Alex wrote:
> > Hi,
> >
> > i'm under Windows XP SP2 and i installed OneClick Installer. So, i began
> to
> > read some documentations and i learnt to use the gets's method.
> >
> > So nothing hard in that, i wrote my program in SciTE:
>
> Don't use SciTE. It isn't part of Ruby. Use your favorite text
> editor (even Notepad). Save the program as "name.rb" and run it
> from the DOS prompt with
>
> ruby name.rb
>
> (To open a DOS prompt, click on
> Start / Programs / Accessories / Command prompt.)
>
> >
> > puts "Hi what's your name?"
> > nom = gets
> > puts "OK Hi " + nom
> >
> > But it don't work. A windows with "c:\ruby\bin\ruby.exe" in the titlebar
> > appear but i can't write anything in it. Nothing. So i close the windows
> and
> > in SciTE i have it:
> > Exit code: -1073741510
> >
> > Can you help me please? And please, don't tell me i have to work under
> Linux
> > ;o)
> >
> > Thanks
> >
> > Alex
>
>
>

Alexandre

4/3/2006 8:07:00 AM

0

Hi,

thanks for your answer, actually, i found it after my message. But on
Windows, in command prompt, you have to be in the directory which contain
the program.
I havec to type:
cd cd mysampledir\ex1
ruby name.rb

And it works!

Thanks

>
> Don't use SciTE. It isn't part of Ruby. Use your favorite text
> editor (even Notepad). Save the program as "name.rb" and run it
> from the DOS prompt with
>
> ruby name.rb
>
> (To open a DOS prompt, click on
> Start / Programs / Accessories / Command prompt.)


julian

4/3/2006 11:51:00 AM

0

I have found just the same thing myself.. You can use SciTE to write
the ruby program, and do make sure you give it a .rb extenstion, and do
make sure that you save it before running it. But when is comes to
running it you should run it from inside the command prompt, not from
inside sciTE. If the program has no lines in it using gets then it will
probably run in SciTE, but if you are using gets then run it in the
cmd prompt.
The other interesting things are :
1 what if you want to put the ruby program in to a part of rails, and
where and how to do this..
You can put ruby code into parts of rails but you should surround the
ruby code with <%= and %> I think, and of course you must have a ruby
server running on the machine that you have the file on, otherwise no
ruby code will be interprested at all!