From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 123473 invoked by alias); 12 Apr 2015 00:15:38 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 123462 invoked by uid 89); 12 Apr 2015 00:15:37 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=1.8 required=5.0 tests=BAYES_50,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_NONE,T_RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: elasmtp-galgo.atl.sa.earthlink.net Received: from elasmtp-galgo.atl.sa.earthlink.net (HELO elasmtp-galgo.atl.sa.earthlink.net) (209.86.89.61) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 12 Apr 2015 00:15:36 +0000 Received: from [209.86.224.52] (helo=mswamui-valley.atl.sa.earthlink.net) by elasmtp-galgo.atl.sa.earthlink.net with esmtpa (Exim 4.67) (envelope-from ) id 1Yh5Yk-0001Mn-B2 for Cygwin@cygwin.com; Sat, 11 Apr 2015 20:15:34 -0400 Received: from 104.6.106.210 by webmail.earthlink.net with HTTP; Sat, 11 Apr 2015 20:15:33 -0400 Message-ID: <29768395.1428797734177.JavaMail.root@mswamui-valley.atl.sa.earthlink.net> Date: Sun, 12 Apr 2015 00:15:00 -0000 From: Randy Decker Reply-To: Randy Decker To: Cygwin@cygwin.com Subject: Executable from x86_64-w64-mingw32-gcc.exe waits for input before prompt in Cygwin terminal but not Win Command Prompt Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ELNK-Trace: f60401d2840109845356d8586c7240949ef193a6bfc3dd48cad17a0c09ec42aa5e84bd42d5e4adc1a2d4e88014a4647c350badd9bab72f9c350badd9bab72f9c X-SW-Source: 2015-04/txt/msg00226.txt.bz2 # Brief problem description # C source file - 'printf("Test");' added as diagnostics # Source compiles and executes in Ubuntu # Executable compiled in cygwin terminal OK in command prompt W8.1 # - Also OK in another machine running Windows 8.1 # Same executable in cygwin term waits for input before usage hint FROM CYGWIN64 TERMINAL Randy@Hartford ~ $ cat countbytes.c /* This program counts the number of bytes in a C source file. The program prompts the user for a file name and then concatenates the ".c" extension to this name. It uses the function getc to read the characters. program from "Applications Programming in ANSI C" by Hohnsonbaugh & Kalin */ #include #include #include main( ) { FILE* fptr; char extension[] = ".c"; int char_count; printf("Test"); printf("\n\n\tFile name (NO extension):\t"); char file_name[FILENAME_MAX]; /* defined in stdio.h*/ scanf("%s",file_name); strcat(file_name,extension); fptr=fopen(file_name,"rb"); for(char_count=0; getc(fptr) !=EOF; ++char_count); printf("\n\tByte size:\t%d", char_count); printf("\n"); fclose(fptr); return EXIT_SUCCESS; } # Confirm Countbytes.exe not yet here Randy@Hartford ~ $ ls -a . .swp myhello.exe .$$$ countbytes.c myhello2.exe .. countem.exe myhelloworld.c .bash_history countem3.exe testc.c .bash_profile countemm.exe testit.exe .bash_profile_temp countemm2.exe testittestc.exe .bash_profileWin.txt countOnUbuntu.txt testtext.txt .bashrc cygwinResults.txt welcome.exe .bashrc_ORG Hello.c x86_64-w64-mingw32-gcc.exe .inputrc HelloFromUnix.c .profile HelloFromUnix-PFEvsNotepad.c # Show alias Randy@Hartford ~ $ alias alias gcc='C:/cygwin64/bin/x86_64-w64-mingw32-gcc.exe' # Compile the program Randy@Hartford ~ $ gcc -o countbytes countbytes.c # Verify countbytes.exe now exists Randy@Hartford ~ $ ls countbytes.c cygwinResults.txt Progress_Notes.txt ->countbytes.exe Hello.c testc.c countem.exe HelloFromUnix.c testit.exe countem3.exe HelloFromUnix-PFEvsNotepad.c testittestc.exe countemm.exe myhello.exe testtext.txt countemm2.exe myhello2.exe welcome.exe countOnUbuntu.txt myhelloworld.c x86_64-w64-mingw32-gcc.exe # Execute the output in cygwin64 terminal. Program waits with no output # Until enter is pressed on a non blank line. Randy@Hartford ~ $ ./countbytes countbytes Test File name (NO extension): Byte size: 865 Randy@Hartford ~ # Demonstrate same files as Cygwin64 Terminal FROM WINDOWS 8.1 COMMAND PROMPT Directory of C:\cygwin64\home\Randy [.] [..] .$$$ .bashrc .bashrc_ORG .bash_history .bash_profile .bash_profileWin.txt .bash_profile_temp .inputrc .profile .swp countbytes.c ->countbytes.exe countem.exe countem3.exe countemm.exe countemm2.exe countOnUbuntu.txt cygwinResults.txt Hello.c HelloFromUnix-PFEvsNotepad.c HelloFromUnix.c myhello.exe myhello2.exe myhelloworld.c Progress_Notes.txt testc.c testit.exe testittestc.exe testtext.txt welcome.exe x86_64-w64-mingw32-gcc.exe 31 File(s) 1,289,107 bytes 2 Dir(s) 142,941,614,080 bytes free # Execute the output in Windows command prompt terminal. # Program PRINTS " File name (NO extension):" # then waits Until filename is entered. # NOTE: Execution of same code in Ubuntu 14.4 works like this. C:\cygwin64\home\Randy>countbytes Test File name (NO extension): countbytes Byte size: 865 C:\cygwin64\home\Randy> -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple