Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to print argv[0] to stdout

Status
Not open for further replies.

peterv6

Programmer
Sep 10, 2005
70
0
0
US
I'm a newbie to Ruby & OO programming, so please bear with me.
searched the forum & didn't find anything relevant. I want to print the value of argv[0] to standard output, but I can't figure out the syntax. Below is one of the ways I tried, but it obviously doesn't work. I'd appreciate any advice anyone can provide, along with syntax that will get this to work.


$stdout.print "Invalid filename entered: argv[0] \n"

I know it won't print since it's within the quotes, but I've tried all the combinations I could think of with no luck.

PETERV
Syracuse, NY &
Boston, MA
 
You can put the value of a variable into a string using this syntax:
Code:
"The value of a_variable is #{a_variable}"
Those are {curly braces}, not (parentheses).

Also, you're likely trying to use [tt]ARGV[/tt] instead of [tt]argv[/tt].
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top