www.delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT com |
DomainKey-Signature: | a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id |
:list-unsubscribe:list-subscribe:list-archive:list-post | |
:list-help:sender:message-id:date:from:reply-to:to:subject | |
:mime-version:content-type:content-transfer-encoding; q=dns; s= | |
default; b=fjyvltwL+/WQdvN6O7FrEp9JyFHV3usC8ybJPCzR+IYeyyM85pCse | |
/LHp4jV9T7H+u+w7DDIHO3WfB5Y0JFxZFImWCMOIGLjK+anWoDonrsMGQZr+0SBI | |
HFG66SdSqH+v+FYK/mftZKY0XH/qaQ7mEBnMcpAPHcnsN4Y1c/SKBI= | |
DKIM-Signature: | v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id |
:list-unsubscribe:list-subscribe:list-archive:list-post | |
:list-help:sender:message-id:date:from:reply-to:to:subject | |
:mime-version:content-type:content-transfer-encoding; s=default; | |
bh=OT3DtSSGbtocfTi9g9fZECxo8/c=; b=uRPa4dcBs/oXUunxWJtdJZqOh4y8 | |
zrWW8cq3UpWq1+wzeea9XMMNKrXOg49CU9DcJIpLicdUOrgvd01vpd1Ocm+xBTRj | |
yWoLKKXWa/0h/sqFOJkc6MG7fJsT2EcewwroeRpKnOed2IKvA4ypvh+FbzEVgSfa | |
YawPRFvIOvqb59A= | |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Id: | <cygwin.cygwin.com> |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sourceware.org/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/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 |
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 |
Message-ID: | <29768395.1428797734177.JavaMail.root@mswamui-valley.atl.sa.earthlink.net> |
Date: | Sat, 11 Apr 2015 20:15:33 -0400 (EDT) |
From: | Randy Decker <randydecker AT earthlink DOT net> |
Reply-To: | Randy Decker <randydecker AT earthlink DOT net> |
To: | Cygwin AT cygwin DOT 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 |
X-ELNK-Trace: | f60401d2840109845356d8586c7240949ef193a6bfc3dd48cad17a0c09ec42aa5e84bd42d5e4adc1a2d4e88014a4647c350badd9bab72f9c350badd9bab72f9c |
# 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 AT 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<stdlib.h> #include<stdio.h> #include<string.h> 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 AT 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 AT Hartford ~ $ alias alias gcc='C:/cygwin64/bin/x86_64-w64-mingw32-gcc.exe' # Compile the program Randy AT Hartford ~ $ gcc -o countbytes countbytes.c # Verify countbytes.exe now exists Randy AT 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 AT Hartford ~ $ ./countbytes countbytes Test File name (NO extension): Byte size: 865 Randy AT 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
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |