Thread: calling programs

  1. #1
    Registered User
    Join Date
    Feb 2002
    Posts
    29

    calling programs

    Hi there,

    how can I call an other program in the currently running program using the spawn ... family of functions ?

    I've tried calling a program called checksum which takes three char* args like this:

    spawnl (P_WAIT, checksum arg1,arg2,arg3,NULL);


    arg1 and arg3 are both filenames;arg1 is a file present in the working directory and arg3 is a file to be created by checksum.
    arg2 is a simple char* switch.
    Checksum.exe also exists in the same directory.

    I can't get it to work ...

    Can you help ?

    Thanks,

    bigSteve

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Read the manual - spawnl args start at arg0, not arg1

    spawnl (P_WAIT, checksum, checksum,arg1,arg2,arg3,NULL);

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Communication between programs?
    By johny145 in forum Windows Programming
    Replies: 3
    Last Post: 06-01-2005, 10:14 PM
  2. Problem using java programs within C code
    By lemania in forum Linux Programming
    Replies: 1
    Last Post: 05-08-2005, 02:02 AM
  3. calling functions within functions
    By edd1986 in forum C Programming
    Replies: 3
    Last Post: 03-29-2005, 03:35 AM
  4. POSIX/DOS programs?
    By nickname_changed in forum C++ Programming
    Replies: 1
    Last Post: 02-28-2003, 05:42 AM
  5. Altering The Program's Executable?
    By Aidman in forum C++ Programming
    Replies: 7
    Last Post: 12-31-2002, 05:11 AM