delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/07/01/23:15:11

Xref: news2.mv.net comp.os.msdos.djgpp:5569
From: pdmillik AT mpx DOT com DOT au (Peter Milliken)
Newsgroups: comp.os.msdos.djgpp
Subject: Bug in sub-program calls
Date: 1 Jul 1996 23:05:36 GMT
Organization: Microplex Pty Ltd
Lines: 62
Message-ID: <4r9lk0$7io@inferno.mpx.com.au>
NNTP-Posting-Host: jolt.mpx.com.au
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I believe there is a bug in the routines that invoke other programs. I 
have been trying to write a simple program that invokes the xcopy 
command, but I keep getting an error message "invalid drive 
specification" when I run the program. I don't think there is anything I 
am doing wrong. I have tried the same code with other DOS commands such 
as the mem command and it works fine. I have tried using the system call 
and the spawn* call but both give the same error message. 

I am using a 486 on a PC-NFS linked network (I don't think PC-NFS is 
causing the problem, but this info might help).

Can someone help on this one? Is this another symptom of a bug that has 
been already reported?

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <process.h>

void main(int argc, char *argv[])
{
  int result;

  /* 
  ** This works ok. 
  */
  result = spawnlp(P_WAIT, 
                   "c:\\dos\\mem.exe", 
                   "c:\\dos\\mem.exe", 
                   "/c",
                   0);
  /* 
  ** This gives "invalid drive specification error
  */
  result = spawnlp(P_WAIT, 
                   "c:\\dos\\xcopy.exe", 
                   "c:\\dos\\xcopy.exe", 
                   "c:\\test.c r:\\",
                   0);
  /* 
  ** So does this (invalid drive specificiation)
  */
  system("c:\\dos\\xcopy.exe c:\\test.c r:\\");
  /*
  ** This is OK
  */
  result = spawnlp(P_WAIT, 
                   "c:\\dos\\move.exe", 
                   "c:\\dos\\move.exe", 
                   "c:\\test.c r:\\",
                   0);
  /* 
  ** And so is this OK
  */
  system("c:\\dos\\move.exe r:\\test.c c:\\");
}

-- 
--------------------------------------------- _--_|\  |
Peter Milliken (pdmillik AT mpx DOT com DOT au)         /      \ |
CAE Electronics (Australia) Pty. Ltd.        \_.--._/ |
120 Silverwater Rd, Silverwater, N.S.W., 2128.     v  |

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019