setting execv arguments

D

Douglas Dillon

I am trying to use tiffcp to reconfigure tif files (if they are tiled)
to nontiled so I can use existing code to handle them. However, I am
having issues providing the arguments. The app is run from a temp
directory which has local copy of tiffcp.

///////////////////////////////////////////////////////////////////////////
char *args[] = { "tiffcp", "-p", "contig", "-s", "-r", "1", "-c",
"none", stripe->tif_file_name, dstfile };

if (execv(NULL, args) == -1)
///////////////////////////////////////////////////////////////////////////

What is the proper format?

Thanks,

Douglas
 
W

Walter Roberson

:I am trying to use tiffcp to reconfigure tif files (if they are tiled)
:to nontiled so I can use existing code to handle them. However, I am
:having issues providing the arguments. The app is run from a temp
:directory which has local copy of tiffcp.

:char *args[] = { "tiffcp", "-p", "contig", "-s", "-r", "1", "-c",
:"none", stripe->tif_file_name, dstfile };

:if (execv(NULL, args) == -1)

execv() is not part of C itself, so this is not covered by the C standard.

:What is the proper format?

I've never seen NULL as the first argument of execv() before.
The first argument should be the path to the executable. If it is in
your current directory, then you would use "./tiffcp" as the path
in your case.
 
J

Jens.Toerring

Walter Roberson said:
:I am trying to use tiffcp to reconfigure tif files (if they are tiled)
:to nontiled so I can use existing code to handle them. However, I am
:having issues providing the arguments. The app is run from a temp
:directory which has local copy of tiffcp.
:char *args[] = { "tiffcp", "-p", "contig", "-s", "-r", "1", "-c",
:"none", stripe->tif_file_name, dstfile };
:if (execv(NULL, args) == -1)
execv() is not part of C itself, so this is not covered by the C standard.

And thus questions should be asked in e.g. comp.unix.programmer;-)
:What is the proper format?
I've never seen NULL as the first argument of execv() before.
The first argument should be the path to the executable. If it is in
your current directory, then you would use "./tiffcp" as the path
in your case.

<OT>
And you need a additional NULL pointer at the end of the 'args' array.
</OT>
Regards, Jens
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top