This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

fread help!


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]