Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 wtd, ruby questions
Index -> Programming, Ruby -> Ruby Help
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8, 9  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
dsantamassino




PostPosted: Sat Nov 06, 2004 11:01 pm   Post subject: (No subject)

wtd wrote:
Nifty... so now you get input from the user.

Time to learn how to create files and run those.

Do you know how to change directories in DOS?


kind of but not to well. I know i would type C: or something to get it on my drive but not sure.
Sponsor
Sponsor
Sponsor
sponsor
wtd




PostPosted: Sat Nov 06, 2004 11:06 pm   Post subject: (No subject)

Yep.

First off, save the following simple program in a file named "greet.rb".

code:
puts "Your name is?"
name = gets
puts "Hello, " + name + "!"


Remember where you saved it.
dsantamassino




PostPosted: Sat Nov 06, 2004 11:10 pm   Post subject: (No subject)

ok i did save it.
wtd




PostPosted: Sat Nov 06, 2004 11:12 pm   Post subject: (No subject)

Open up a command prompt. Start -> Run, type "cmd" and hit enter.

Now, get to the drive where you saved the file.
dsantamassino




PostPosted: Sat Nov 06, 2004 11:28 pm   Post subject: (No subject)

I went to my C drive and then i typed in greet that didnt work so i typed in greet.rb and that didnt work..
wtd




PostPosted: Sat Nov 06, 2004 11:33 pm   Post subject: (No subject)

Did you save the file at the root of your C drive?
dsantamassino




PostPosted: Sat Nov 06, 2004 11:34 pm   Post subject: (No subject)

Yes

wtd wrote:
Did you save the file at the root of your C drive?
wtd




PostPosted: Sat Nov 06, 2004 11:40 pm   Post subject: (No subject)

Type "dir /B" and hit enter. See if greet.rb is in that list.
Sponsor
Sponsor
Sponsor
sponsor
dsantamassino




PostPosted: Sun Nov 07, 2004 7:06 am   Post subject: (No subject)

No its not there.
wtd




PostPosted: Sun Nov 07, 2004 5:06 pm   Post subject: (No subject)

I thought not.

You'll need to "cd" to the directory (or "folder") greet.rb is in. The basic format is:

code:
C:\> cd "the folder\the file\is in"
dsantamassino




PostPosted: Sun Nov 07, 2004 6:09 pm   Post subject: (No subject)

Not a clue what to do here. this is what i typed and didnt work.

It was already pointed to the C: drive so on that line i typed.

cd C\greet.rb
Hikaru79




PostPosted: Sun Nov 07, 2004 10:33 pm   Post subject: (No subject)

Nono, what he means is that first you have to cd into the directory with the .rb file in it. So if the .rb file is in "C:\Documents\Programming\Ruby\" then type:

code:
cd c:
cd Documents
cd Programming
cd Ruby
ruby greet.rb


Or, if you're feeling adventurous,

code:
cd c:\Documents\Programming\Ruby\
ruby greet.rb


If it's already IN root C;\ and that's where you are by defult, you don't need to cd anywhere. Just: ruby greet.rb
dsantamassino




PostPosted: Sun Nov 07, 2004 10:48 pm   Post subject: (No subject)

Hikaru79 wrote:
Nono, what he means is that first you have to cd into the directory with the .rb file in it. So if the .rb file is in "C:\Documents\Programming\Ruby\" then type:

code:
cd c:
cd Documents
cd Programming
cd Ruby
ruby greet.rb


Or, if you're feeling adventurous,

code:
cd c:\Documents\Programming\Ruby\
ruby greet.rb


If it's already IN root C;\ and that's where you are by defult, you don't need to cd anywhere. Just: ruby greet.rb


It already on my root C so i typed ruby greet.rb and this is the message im getting.

ruby: No such file or directory -- greet.rb (LoadError)
wtd




PostPosted: Mon Nov 08, 2004 12:29 am   Post subject: (No subject)

Ok... the file is obviously not in C:\, so trying to run it from there will not work.

Where exactly did you save the file? Use the search feature if you have to.
dsantamassino




PostPosted: Mon Nov 08, 2004 6:29 pm   Post subject: (No subject)

wtd wrote:
Ok... the file is obviously not in C:\, so trying to run it from there will not work.

Where exactly did you save the file? Use the search feature if you have to.


well i did a search and it says C:\
Display posts from previous:   
   Index -> Programming, Ruby -> Ruby Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 6 of 9  [ 129 Posts ]
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8, 9  Next
Jump to:   


Style:  
Search: