delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1998/05/09/01:11:01

From: earnie_boyd AT yahoo DOT com (Earnie Boyd)
Subject: Re: system() call behaviour.
9 May 1998 01:11:01 -0700 :
Message-ID: <19980508162603.7896.rocketmail.cygnus.gnu-win32@send1e.yahoomail.com>
Reply-To: earnie_boyd AT yahoo DOT com
Mime-Version: 1.0
To: Dan Paslawski <paslawsk AT cadvision DOT com>,
"'Cygnus Request'" <gnu-win32 AT cygnus DOT com>
Cc: "'Us'" <paslawsk AT cadvision DOT com>

---Dan Paslawski <paslawsk AT cadvision DOT com> wrote:
>
> 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?

MSDOS shells cmd.exe/command.com do not understand the /bin/sort path.
 I suggest that you set PATH to point to the sort executable and
remove the /bin/ from the command.


> 
> Dan
> -
> For help on using this list (especially unsubscribing), send a
message to
> "gnu-win32-request AT cygnus DOT com" with one line of text: "help".
> 

==
-        \\||//
---o0O0--Earnie--0O0o----
--earnie_boyd AT yahoo DOT com--
------ooo0O--O0ooo-------



_________________________________________________________
DO YOU YAHOO!?
Get your free @yahoo.com address at http://mail.yahoo.com

-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


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