On Mon, 6 Sep 2004 14:45:25 +0100 (BST), Ankit Jain <ankitjain1580@xxxxxxxxx> wrote > 1 #include<stdlib.h> > 2 #include<complex.h> > 3 #include<stdio.h> > 4 > 5 int main() > 6 { > 7 FILE *fp; > 8 fp=fopen("test_data.dat","rb"); > 9 int N=32,i=0; > 10 complex x,*in; > 11 in=malloc(sizeof(complex)*N); > 12 if (fread(in,16,32,fp) != 32) > 13 printf("error in reading from file > failed\n"); > 14 else{ > 15 for(i=0;i<N;i++) > 16 printf("%lf\t",*(in+i+0)); > 17 } > 18 return 0; > 19 } > > i am sorry but this code also gives the same error > > error in reading from file failed So, the problem is with the data you are trying to read. Why don't you write : if (fread(in, sizeof(complex) , N, fp) != N) [..Zappé 47 lignes et 1698 caractères..] À+ PP -- Groupe Morbihannais d'Utilisateurs de Logiciels Libres http://www.tuxbihan.org GPG fingerprint = 1A4F E154 3D2C A20E E4CA A543 7951 C5C2 E44A A0B5 Patrick Percot.