fread help!

GI-HYEON PARK gpark@email.arizona.edu
Thu Aug 9 11:44:00 GMT 2001


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/



More information about the Cygwin mailing list