* i am sending the file also
@ 2004-09-06 15:28 Ankit Jain
2004-09-06 15:47 ` Patrick Percot
0 siblings, 1 reply; 2+ messages in thread
From: Ankit Jain @ 2004-09-06 15:28 UTC (permalink / raw)
To: gcc
[-- Attachment #1: Type: text/plain, Size: 987 bytes --]
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
[-- Attachment #2: test_data.dat --]
[-- Type: application/octet-stream, Size: 256 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: i am sending the file also
2004-09-06 15:28 i am sending the file also Ankit Jain
@ 2004-09-06 15:47 ` Patrick Percot
0 siblings, 0 replies; 2+ messages in thread
From: Patrick Percot @ 2004-09-06 15:47 UTC (permalink / raw)
To: gcc-help
On Mon, 6 Sep 2004 16:28:44 +0100 (BST), Ankit Jain <ankitjain1580@yahoo.com> wrote
> i am still not able ot understand whats the error
>
> the file consists of binary data. basically contains
> 32 complex nos.
>
Not 32, but only 16.
[..Zappé 34 lignes et 933 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.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-09-06 15:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-06 15:28 i am sending the file also Ankit Jain
2004-09-06 15:47 ` Patrick Percot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).