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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing Functions as Parameters 1

Status
Not open for further replies.

aaiqbal

Programmer
Sep 15, 2003
26
US
How do I pass a function as a parameter? Also, does main accept parameters?
 
Are you asking if a function can be passed as a parameter to a procedure? If so, then this cannot be done. You would need to save the result of the function to a variable, then pass that value when calling the procedure.

Main does not take any parameters per se, but if you run it via the command line, you can pass values into it via the predefined global variables. Here is a snippet from my site discussing this:

You can pass variables to Procomm Plus via the command line used to start the application. For example, the command line "C:\Program Files\Symantec\Procomm Plus\Programs\PW5.exe myscript.wax test" will launch Procomm Plus, execute the script myscript.wax and place the word test in the predefined global string variable s0. Up to 10 values may be passed in. The values will be placed in the global strings s0 through s9, and the number of passed variables will be placed in the predefined global integer i0. Your script can then use the atoi, atol, or atof commands to convert the string values to integers, longs, or floats, if necessary.

aspect@aspectscripting.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top