0

Hello im new to smalltalk and was wondering how to get number of arguments passed through the command line. Sorry this is such a basic question.

Uko
  • 13,134
  • 6
  • 58
  • 106
user1314272
  • 141
  • 1
  • 13
  • Which dialect of smalltalk are you using? (also, should I tell you that using command line with smalltalk is not the most common thing to do, and so starting learning smalltalk from command line stuff is probably not the best choice?) – Uko Nov 14 '15 at 00:16
  • general gnu small talk, not squeak or anything. I understand this is not the best choice but I have a problem which im tying to solve and need to do it in this manner. – user1314272 Nov 14 '15 at 00:27
  • In Gnu Smalltalk, you can use `Smalltalk getArgc` to get the argument count, and `Smalltalk getArgv: n` to read argument `n`. – lurker Nov 14 '15 at 21:47

1 Answers1

1

There's GetOpt.st file that probably does what you want. It was written for gnu smalltalk 3.2.5 and is located at http://fossies.org/linux/smalltalk/kernel/Getopt.st.

There's also a copy at http://github.com/bonzini/smalltalk/blob/master/kernel/Getopt.st

It may or may not be included in the base image. I haven't used gnu smalltalk in about 6 years.

John Pfersich
  • 135
  • 2
  • 7