f



Looking for Fortran command to get file names from arg lists in executable

fortran command for c command strcopy(infile, argv[1])
0
k_partha (41)
11/19/2007 6:22:26 PM
comp.lang.c 30657 articles. 5 followers. spinoza1111 (3246) is leader. Post Follow

4 Replies
241 Views

Similar Articles

[PageSpeed] 20

In article <127d1168-5eba-4fbe-8bde-d0725878e2c9@f3g2000hsg.googlegroups.com>,
sara_patty  <k_partha@yahoo.com> wrote:
>fortran command for c command strcopy(infile, argv[1])

That's going to depend on the fortran compiler, not upon C.
comp.lang.fortran would be the appropriate newsgroup.

[OT]

See http://www.winteracter.com/f2kcli/
-- 
  "I will speculate that [...] applications [...] could actually see a
  performance boost for most users by going dual-core [...] because it
  is running the adware and spyware that [...] are otherwise slowing
  down the single CPU that user has today"           -- Herb Sutter
0
roberson2 (8602)
11/19/2007 6:46:45 PM
sara_patty wrote:
> fortran command for c command strcopy(infile, argv[1])

Obviously it is better to ask Fortran questions in a Fortran newsgroup. 
  People when posting in comp.lang.c should not be expected to have 
answers which are as reliable about Fortran as those in a Fortran newsgroup.
<ot>
Fortran does not standardly include the ability to inspect the command 
line.  However, many implementations provide non-standard functions with 
names like GETARG, GET_COMMAND, GET_COMMAND_ARGUMENT, and 
COMMAND_ARGUMENT_COUNT.  Check your implementation for details.

For handling objects of type CHAR(*), check your Fortran text for the 
standard functions.  You might want to look up "array assignment" in the 
index; '=' may be all you need.
</ot>
0
mambuhl (2203)
11/19/2007 9:14:19 PM
sara_patty wrote:
> fortran command for c command strcopy(infile, argv[1])
	infile=argv(1)
0
11/20/2007 1:43:52 AM
On Mon, 19 Nov 2007 16:14:19 -0500, Martin Ambuhl
<mambuhl@earthlink.net> wrote:

> sara_patty wrote:
> > fortran command for c command strcopy(infile, argv[1])
> 
> Obviously it is better to ask Fortran questions in a Fortran newsgroup. 
>   People when posting in comp.lang.c should not be expected to have 
> answers which are as reliable about Fortran as those in a Fortran newsgroup.
> <ot>
> Fortran does not standardly include the ability to inspect the command 
> line.  However, many implementations provide non-standard functions with 
> names like GETARG, GET_COMMAND, GET_COMMAND_ARGUMENT, and 
> COMMAND_ARGUMENT_COUNT.  Check your implementation for details.
> 
<still ot>
As of 'F03' (actually adopted in 2004), it does. (Many probably most
implementations also still provide their former extensions.)

This is frequently discussed on comp.lang.fortran, which indeed is the
better place for Fortran questions. And FORTRAN ones. (And the
difference between those! <G>) And I see that the OP has indeed posted
there and received good answers.

> For handling objects of type CHAR(*), check your Fortran text for the 
> standard functions.  You might want to look up "array assignment" in the 
> index; '=' may be all you need.

No but yes. Fortran character string types -- CHARACTER(len) and in
limited cases CHARACTER(*) -- are not actually the same type as array
of character, as they are in C (and Pascal and Ada), though they are
represented that way internally. But intrinsic (builtin) assignment
(=) applies both to strings and most arrays including of characters. 

Also note Fortran (builtin, un-F03-allocable) strings are fixed-length
blank-padded, not variable null-terminated as in C. Thus a number of
operations and idioms are different -- not necessarily better or
worse, just different -- and there's a (more serious) headache when
interfacing between the two languages (or others with similar issues).

> </ot>
- formerly david.thompson1 || achar(64) || worldnet.att.net
0
12/3/2007 6:15:53 AM
Reply: