Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com X-Authentication-Warning: slinky.cs.nyu.edu: pechtcha owned process doing -bs Date: Wed, 15 Oct 2003 10:52:49 -0400 (EDT) From: Igor Pechtchanski Reply-To: cygwin AT cygwin DOT com To: cygwin AT cygwin DOT com Subject: RE: system() refuses to work!!! HELP In-Reply-To: Message-ID: References: Importance: Normal MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On Wed, 15 Oct 2003, Chris January wrote: > > 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 > > #include > > #include > > > > 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("\nNumero 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 Ah, but there is a "dir.exe" in fileutils on Cygwin. IOW, the following worked for me: $ cat > moises.c #include main() { system("dir"); } $ make moises gcc moises.c -o moises $ ./moises moises.c moises.exe $ At a guess, the OP is not using gcc or Cygwin at all. If so, the question is off-topic for this list. Igor -- http://cs.nyu.edu/~pechtcha/ |\ _,,,---,,_ pechtcha AT cs DOT nyu DOT edu ZZZzz /,`.-'`' -. ;-;;,_ igor AT watson DOT ibm DOT com |,4- ) )-,_. ,\ ( `'-' Igor Pechtchanski, Ph.D. '---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow! "I have since come to realize that being between your mentor and his route to the bathroom is a major career booster." -- Patrick Naughton -- 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/