For Programmers: Free Programming Magazines  


Home > Archive > Clipper > September 2006 > parameters









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author parameters
itko59@gmail.com

2006-09-11, 6:55 pm

Hi folk!
I need to know /I'm not a clipper "old timer";)/ how to give parameters
to a clipper .exe. Ex: I want to make an exe where to copy a file /dbf/
to another dbf and want to give names of the source and target in a
parameter line, separated with comma in the command line: myprog .exe
<source F>,<targetF>
ThanX in advance !

bill robertson

2006-09-11, 6:55 pm

> I need to know /I'm not a clipper "old timer";)/ how to give parameters
> to a clipper .exe. Ex: I want to make an exe where to copy a file /dbf/
> to another dbf and want to give names of the source and target in a
> parameter line, separated with comma in the command line: myprog .exe
> <source F>,<targetF>
>


// compile: clipper /m/n
function main( arg1, arg2, arg3 )

? arg1
? arg2
? arg3

return 0


pete@nospam.demon.co.uk

2006-09-11, 6:55 pm

In article <1157994834.211690.22820@q16g2000cwq.googlegroups.com>
itko59@gmail.com writes:

> Hi folk!
> I need to know /I'm not a clipper "old timer";)/ how to give parameters
> to a clipper .exe. Ex: I want to make an exe where to copy a file /dbf/
> to another dbf and want to give names of the source and target in a
> parameter line, separated with comma in the command line: myprog .exe
> <source F>,<targetF>
> ThanX in advance !


No need for the comma -- just read the manual to see what you
need to do, Old Timer or not...

Pete
--
"We have not inherited the earth from our ancestors,
we have borrowed it from our descendants."
Robert Haley

2006-09-11, 6:55 pm

Greetings,


> I need to know /I'm not a clipper "old timer";)/ how to give parameters
> to a clipper .exe.


It depends on which version of Clipper you are using, there are a few
different ways.

In all cases, you will accept and test the parameters passed on the
command-line in the -first- module in your program, e.g. the first
procedure or function in the first program -> object (.obj) file you
link into the executable.

You should pass each parameter separated by a (space) character on the
command line, e.g. MYCOPY c:\test\mydbf.dbf c:\test\newdbf.dbf

You can accept multiple parameters separated by a comma as a single
parameter string, although passing multiple parameters each separated
by a space character is easier to code for.)

Summer '87:
------------------
PARAMETERS cSource, cDest

* Test for valid type:

IF TYPE( cSource ) = "U"
* parameter not passed!
ELSE
* ... process the passed string here
ENDIF

IF TYPE( cDest ) = "U"
* parameter not passed!
ELSE
* ... process the passed string here
ENDIF

-----
In the above example (2) new variables were created with a visibility
scope of PRIVATE to the current and all subordinate modules. The TYPE
of each variable is tested to determine if a string was passed for the
value of each argument expected.

For Clipper 5.x, if you are not using an explicit starting prodedure or
function, above code also applies.


For code that uses an explicit starting procedure or function as the
first module (compiled with the /N switch), following this is the code
I typically use:

#include: "Common.ch"

FUNCTION CopyFile( cSource, cDest )

DEFAULT cSource TO ""
DEFAULT cDest TO ""

IF EMPTY( cSource )
// parameter not passed!
ELSE
//... process the passed string here
ENDIF

IF EMPTY( cDest )
// parameter not passed!
ELSE
// ... process the passed string here
ENDIF

RETURN

The Clipper 5.x sample defines the parameters with a visibility scope
of LOCAL to the function declaration and uses the (psuedo) statement
DEFAULT (in common.ch) to test the parameter's value. If the value is
NIL, the DEFAULT statement will change the value to an empty string.

I hope the above info helps.

Regards,
Bob

itko59@gmail.com

2006-09-12, 3:55 am

ThanX bunch !
Chris
Robert Haley =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0:[co
lor=darkred]
> Greetings,
>
>
>
> It depends on which version of Clipper you are using, there are a few
> different ways.
>
> In all cases, you will accept and test the parameters passed on the
> command-line in the -first- module in your program, e.g. the first
> procedure or function in the first program -> object (.obj) file you
> link into the executable.
>
> You should pass each parameter separated by a (space) character on the
> command line, e.g. MYCOPY c:\test\mydbf.dbf c:\test\newdbf.dbf
>
> You can accept multiple parameters separated by a comma as a single
> parameter string, although passing multiple parameters each separated
> by a space character is easier to code for.)
>
> Summer '87:
> ------------------
> PARAMETERS cSource, cDest
>
> * Test for valid type:
>
> IF TYPE( cSource ) =3D "U"
> * parameter not passed!
> ELSE
> * ... process the passed string here
> ENDIF
>
> IF TYPE( cDest ) =3D "U"
> * parameter not passed!
> ELSE
> * ... process the passed string here
> ENDIF
>
> -----
> In the above example (2) new variables were created with a visibility
> scope of PRIVATE to the current and all subordinate modules. The TYPE
> of each variable is tested to determine if a string was passed for the
> value of each argument expected.
>
> For Clipper 5.x, if you are not using an explicit starting prodedure or
> function, above code also applies.
>
>
> For code that uses an explicit starting procedure or function as the
> first module (compiled with the /N switch), following this is the code
> I typically use:
>
> #include: "Common.ch"
>
> FUNCTION CopyFile( cSource, cDest )
>
> DEFAULT cSource TO ""
> DEFAULT cDest TO ""
>
> IF EMPTY( cSource )
> // parameter not passed!
> ELSE
> //... process the passed string here
> ENDIF
>
> IF EMPTY( cDest )
> // parameter not passed!
> ELSE
> // ... process the passed string here
> ENDIF
>
> RETURN
>
> The Clipper 5.x sample defines the parameters with a visibility scope
> of LOCAL to the function declaration and uses the (psuedo) statement
> DEFAULT (in common.ch) to test the parameter's value. If the value is
> NIL, the DEFAULT statement will change the value to an empty string.
>=20
> I hope the above info helps.
>=20
> Regards,
> Bob[/color]

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com