delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/08/09/14:46:01

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Reply-To: <gpark AT email DOT arizona DOT edu>
From: "GI-HYEON PARK" <gpark AT email DOT arizona DOT edu>
To: <cygwin AT cygwin DOT com>
Subject: fread help!
Date: Thu, 9 Aug 2001 11:42:31 -0700
Message-ID: <LJEJLCGFPDGEMKKGJEAKEEOECAAA.gpark@email.arizona.edu>
MIME-Version: 1.0
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700
Importance: Normal

Hi,

I am trying to read binary file in WIN ME and it does not read data
correctly.
I tried the same code in solaris and it works fine..

Does anybody know why C program in WIN ME reads data wrong?

Thanks..

Here is my code..

#include <stdio.h>
#include <stdlib.h>
#include "MATRIX.h"
#include "MATRIX.c"
#include "SetValue.h"
#include "SetValue.c"

int main(void)
{
	char data[200];
	int k,m;
	float **rin,**rout;
	FILE *fp;

	rout=M2D_alloc(400,480);
	rin=M2D_alloc(400,480);
	SetFloatValue(400, 480, rin, -9999.0);
	SetFloatValue(400, 480, rout, -9999.0);

	setmode(fp,'b');
	sprintf(data,"%s","00061_00.bin");

	fp=fopen(ddd,"rb");

	for(k=0;k<400;k++)
		fread( *(rin+k), sizeof (float), 480, fp);  // Is this not working
correctly in Win ME?
    	fclose(fp);

	for(k=0;k<400; k++){
		for(m=0;m<480;m++){
			printf("%8.2f\n",rin[k][m]);
		}
	}

	M2DFree(rin,400);
	M2DFree(rout,400);

}


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.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