From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25939 invoked by alias); 6 Sep 2004 13:32:07 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 25932 invoked from network); 6 Sep 2004 13:32:06 -0000 Received: from unknown (HELO web52902.mail.yahoo.com) (206.190.39.179) by sourceware.org with SMTP; 6 Sep 2004 13:32:06 -0000 Message-ID: <20040906133206.32796.qmail@web52902.mail.yahoo.com> Received: from [202.164.100.133] by web52902.mail.yahoo.com via HTTP; Mon, 06 Sep 2004 14:32:06 BST Date: Mon, 06 Sep 2004 13:32:00 -0000 From: =?iso-8859-1?q?Ankit=20Jain?= Subject: Re: complex variable To: gcc In-Reply-To: <20040906122215.64244.qmail@web52901.mail.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-SW-Source: 2004-09/txt/msg00038.txt.bz2 well i had tried this also fread(in,16,32*16,fp) != 32*16 earlier but dosent work and gives the same error actually i have 32 complex nos whose size is 16byte each so total size is 32*16->its the size not the no. of elements i am reading so i feel fread(in,16,32*16,fp) != 32 this should be right? ankit --- Ankit Jain wrote: > 1 #include > 2 #include > 3 #include > 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*16,fp) != 32) > 13 printf("error in reading from file > failed\n"); > 14 else{ > 15 for(i=0;i 16 printf("%lf\t",*(in+i+0)); > 17 } > 18 return 0; > 19 } > > it gives error > "error in reading the file failed" > > whats wrong? > > ankit > > ________________________________________________________________________ > Yahoo! Messenger - Communicate instantly..."Ping" > your friends today! Download Messenger Now > http://uk.messenger.yahoo.com/download/index.html > ________________________________________________________________________ Yahoo! Messenger - Communicate instantly..."Ping" your friends today! Download Messenger Now http://uk.messenger.yahoo.com/download/index.html