i am sending the file also

Ankit Jain ankitjain1580@yahoo.com
Mon Sep 6 15:28:00 GMT 2004


i am still not able ot understand whats the error

the file consists of binary data. basically contains
32 complex nos.

they have to be stored in "in" array

error:   error in reading from file failed

:(
   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 }
~


________________________________________________________________________
Yahoo! Messenger - Communicate instantly..."Ping" 
your friends today! Download Messenger Now 
http://uk.messenger.yahoo.com/download/index.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_data.dat
Type: application/octet-stream
Size: 256 bytes
Desc: test_data.dat
URL: <https://gcc.gnu.org/pipermail/gcc-help/attachments/20040906/e12fb45b/attachment.obj>


More information about the Gcc-help mailing list