delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/10/15/04:45:25

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
From: "Chris January" <chris AT atomice DOT net>
To: "Cygwin AT Cygwin DOT Com" <cygwin AT cygwin DOT com>
Subject: RE: system() refuses to work!!! HELP
Date: Wed, 15 Oct 2003 09:45:10 +0100
Message-ID: <ICEBIHGCEJIPLNMBNCMKGEAACOAA.chris@atomice.net>
MIME-Version: 1.0
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
In-Reply-To: <E1A9eYj-0000oV-00@m1.dnsix.com>
Importance: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165

> It did not work. Will it be that I found a bug??? How much luck I
> have.. :-)
> It follows the source. that program does not do anything of
> important! It is
> alone a test.
>
> what we most can do?
>
> I changed the command for "DIR" who list the directories of the
> windows just
> to facilitate the comprehension and so that it to do not are
> necessary to do
> an upload of sound.exe. Try, with that program execute some other
> command!
> Here, already tried of everything, and anything (not) worked.
>
>
> *************************************************
>
> #include <stdlib.h>
> #include <math.h>
> #include <stdio.h>
>
> main()
> {
> int a,b,c,d,e,f,g,h,j;
>
> FILE *stream;
>
> printf("Programa Gerador de Resultados para Teste:");
> printf("\n\nEntre com as Faixas");
> printf("\nNúmero a ser comparado: ");scanf("%d",&c);
> printf("\n....................De: ");scanf("%d",&a);
> printf("\n.....................A: ");scanf("%d",&b);
>
> d = c;
> f = a;
> g = b;
>
> j = 1;
>
> while(g <= c){
>      e = f * g;
>      h = d - e;
>      if((stream = fopen("dtr1.txt", "at")) != NULL){
>                 fprintf(stream,"\n %d * %d = %d -r = %d",f,g,e,h);
>      }
>      fflush(stdout);
>      fclose(stream);
>      if(j >= c){
>           f = a;
>           j = 0;
>           g++;
>           printf("\nF: %d\tG %d:",f,g);
>           fflush(stdout);
>      }
>      f++;
>      j++;
> }
>
> if((system("dir")) == 0){
>      printf("\n\nComando executado com sucesso");
> }
> else{
>      printf("\n\ncomando falhou");
> }
>
> }

This program will not work. There is no program called 'dir' in Windows. You
probably want something like 'cmd /c dir'.

Chris


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


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