delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/03/21/23:42:55

X-Spam-Check-By: sourceware.org
Message-ID: <4420D5BE.7040002@cygwin.com>
Date: Tue, 21 Mar 2006 23:42:38 -0500
From: "Larry Hall (Cygwin)" <reply-to-list-only-lh AT cygwin DOT com>
Reply-To: cygwin AT cygwin DOT com
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8) Gecko/20051223 Fedora/1.5-0.2.fc4.remi Thunderbird/1.5 Mnenhy/0.7.3.0
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: Reading too few bytes
References: <Pine DOT LNX DOT 4 DOT 63 DOT 0603212000250 DOT 23743 AT vgfl DOT cnhywyhpnf DOT bet>
In-Reply-To: <Pine.LNX.4.63.0603212000250.23743@vgfl.cnhywyhpnf.bet>
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
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

Paul J. Lucas wrote:
> Here's a small test program:
> 
> 	#include <fcntl.h>
> 	#include <cstdlib>
> 	#include <iostream>
> 	
> 	using namespace std;
> 	
> 	int main() {
> 	    int fd = ::open( "ESLF", O_RDONLY );
> 	    if ( fd == -1 ) {
> 	        cerr << "could not open ESLF file" << endl;
> 	        ::exit( 1 );
> 	    }
> 	    char buf[ 64 ];
> 	    ssize_t bytesRead = ::read( fd, buf, sizeof( buf ) );
> 	    cout << "read " << bytesRead << " bytes" << endl;
> 	    ::close( fd );
> 	}
> 
> Here's the contents of a small biinary file "ESLF" (printed in hex bytes):
> 
> 	54 39 CA 1A 44
> 
> When I compile the program as:
> 
> 	g++ -o test test.cpp
> 
> and run it, it prints "read 5 bytes" as one would expect.  When I compile
> the program as:
> 
> 	g++ -mno-cygwin -o test test.cpp
> 
> and run it, it prints "read 3 bytes".  Why?  How do I teg it to read all
> 5 bytes?

Ask the MinGW llist, since -mno-cygwin simply enables you to run their
compiler "indirectly".  As a result, questions about the MinGW compiler
are off-topic for this list, since it's not Cygwin.
See <http://mingw.org/>.

-- 
Larry Hall                              http://www.rfk.com
RFK Partners, Inc.                      (508) 893-9779 - RFK Office
838 Washington Street                   (508) 893-9889 - FAX
Holliston, MA 01746

--
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