ran zhang <firstname.lastname@example.org> wrote:
Following function works well for source if it is a whole directory ,
pid = spawnl( P_NOWAIT, “/bin/cp”, “cp”, “-vcLR”, “/source”,
“/destination”, NULL );
However, it deosnt work if the /source is like /*.txt when u just want
to copy certain files using *.
The problem is that it isn’t “cp” which expands the *.txt, it is the
Hm… you were asking about getting the pid from a system() call as
well, weren’t you? So, I can’t suggest going back to using system()
to do this.
Depends on how much code you want to write, and what your requirements
Here are a sample of some of the issues to think about, but not possibly
all, before I can know the best answer:
Do you know the files in advance? (That is, you know it is alpha.txt,
beta.txt, gamma.txt and delta.txt; but you are thinking *.txt because
that is what you would type at the command line – or is there some
arbitrary set of files that can be dynamically created that you don’t
track in the code, and won’t know in advance.)
How important is effeciency? Is this going to be a frequent operation?
Is it a setup/backup type operation, or part of normal running?
How important is coding time?
Do you need to know when the operation is finished?
Do you need to do other things while the operation proceeds, or can you
just block on it until it is finished?
QNX Training Services