This is the mail archive of the
cygwin@sourceware.cygnus.com
mailing list for the Cygwin project.
system() call behaviour.
- To: "'Cygnus Request'" <gnu-win32 at cygnus dot com>
- Subject: system() call behaviour.
- From: Dan Paslawski <paslawsk at cadvision dot com>
- Date: Thu, 7 May 1998 10:39:12 -0600
- Cc: "'Us'" <paslawsk at cadvision dot com>
I have an application which performs a sort on a datafile using system utilities
(via the function "system()").
void sort_data(char *fname)
char *command = new char[MAX_SIZE];
sprintf(command, "cp %s %s.BAK", fname, fname);
ercode = system(command);
if (ercode == 0)
{
sprintf(command, "/bin/sort -n +1 -T . %s.BAK > %s", fname, fname);
ercode = system(command);
}
if (ercode != 0) printf("Error %d returned by system()\n", ercode);
When running this under the Cygwin Bash environment, this code works properly. However,
if I run the code in a Windows NT Command Prompt Window (or an MS_DOS Window under
Windows 95), the calls to system() fail. I have also tried this segment of code with other
commands (eg. dir, copy, mspaint), with the same results.
Any suggestions?
Dan
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".