Pour info, j'exécute ce programme sur une distribution UBUNTU.
Voici mon code, en espérant que vous pourrez corriger mes erreurs et me guider
dans la résolution de cet exercice.
35 for( i = 0 ; i < DIM ; i++)
36 {
37 char *tampon;
38 read(fichier, tampon, sizeof(struct complexe));
Pour info, j'exécute ce programme sur une distribution UBUNTU.
Voici mon code, en espérant que vous pourrez corriger mes erreurs et me guider
dans la résolution de cet exercice.
35 for( i = 0 ; i < DIM ; i++)
36 {
37 char *tampon;
38 read(fichier, tampon, sizeof(struct complexe));
Pour info, j'exécute ce programme sur une distribution UBUNTU.
Voici mon code, en espérant que vous pourrez corriger mes erreurs et me guider
dans la résolution de cet exercice.
35 for( i = 0 ; i < DIM ; i++)
36 {
37 char *tampon;
38 read(fichier, tampon, sizeof(struct complexe));
25
26 fichier = open("test2", O_WRONLY|O_CREAT);
27
28 for( i = 0 ; i < DIM ; i++ )
29 write(fichier, tableau[i], sizeof(struct complexe));
30
31 close(fichier);
32
33 open("test2", O_RDONLY);
34
35 for( i = 0 ; i < DIM ; i++)
36 {
37 char *tampon;
38 read(fichier, tampon, sizeof(struct complexe));
39 printf("ligne %d : %sn", i, tampon);
40 }
41 close(fichier);
42
43 }
25
26 fichier = open("test2", O_WRONLY|O_CREAT);
27
28 for( i = 0 ; i < DIM ; i++ )
29 write(fichier, tableau[i], sizeof(struct complexe));
30
31 close(fichier);
32
33 open("test2", O_RDONLY);
34
35 for( i = 0 ; i < DIM ; i++)
36 {
37 char *tampon;
38 read(fichier, tampon, sizeof(struct complexe));
39 printf("ligne %d : %sn", i, tampon);
40 }
41 close(fichier);
42
43 }
25
26 fichier = open("test2", O_WRONLY|O_CREAT);
27
28 for( i = 0 ; i < DIM ; i++ )
29 write(fichier, tableau[i], sizeof(struct complexe));
30
31 close(fichier);
32
33 open("test2", O_RDONLY);
34
35 for( i = 0 ; i < DIM ; i++)
36 {
37 char *tampon;
38 read(fichier, tampon, sizeof(struct complexe));
39 printf("ligne %d : %sn", i, tampon);
40 }
41 close(fichier);
42
43 }
32
33 open("test2", O_RDONLY);
34
32
33 open("test2", O_RDONLY);
34
32
33 open("test2", O_RDONLY);
34
Voici mon code, en espérant que vous pourrez corriger mes erreurs et me guider
dans la résolution de cet exercice.
1 #include <stdio.h>
2 #include <fcntl.h>
3
4 #define DIM 1000
5
6 struct complexe
7 {
8 char c;
9 int i;
10 float f;
11 };
struct complexe tableau[DIM];
...
for( i = 0 ; i < DIM ; i++ )
write(fichier, tableau[i], sizeof(struct complexe));
open ("test2", O_RDONLY);
char *tampon;
read(fichier, tampon, sizeof(struct complexe));
Voici mon code, en espérant que vous pourrez corriger mes erreurs et me guider
dans la résolution de cet exercice.
1 #include <stdio.h>
2 #include <fcntl.h>
3
4 #define DIM 1000
5
6 struct complexe
7 {
8 char c;
9 int i;
10 float f;
11 };
struct complexe tableau[DIM];
...
for( i = 0 ; i < DIM ; i++ )
write(fichier, tableau[i], sizeof(struct complexe));
open ("test2", O_RDONLY);
char *tampon;
read(fichier, tampon, sizeof(struct complexe));
Voici mon code, en espérant que vous pourrez corriger mes erreurs et me guider
dans la résolution de cet exercice.
1 #include <stdio.h>
2 #include <fcntl.h>
3
4 #define DIM 1000
5
6 struct complexe
7 {
8 char c;
9 int i;
10 float f;
11 };
struct complexe tableau[DIM];
...
for( i = 0 ; i < DIM ; i++ )
write(fichier, tableau[i], sizeof(struct complexe));
open ("test2", O_RDONLY);
char *tampon;
read(fichier, tampon, sizeof(struct complexe));
struct complexe tampon ;
read(fichier, (char *) &tampon, sizeof tampon) ;
--
Mickaël Wolff aka Lupus Michaelishttp://lupusmic.org
struct complexe tampon ;
read(fichier, (char *) &tampon, sizeof tampon) ;
--
Mickaël Wolff aka Lupus Michaelishttp://lupusmic.org
struct complexe tampon ;
read(fichier, (char *) &tampon, sizeof tampon) ;
--
Mickaël Wolff aka Lupus Michaelishttp://lupusmic.org
Bonjour,
Bonjour,
Bonjour,
Bonjour,
Bonjour,
Bonjour,
struct complexe tampon ;
read(fichier, (char *) &tampon, sizeof tampon) ;
A quoi sert le cast ? Le type attendu par read() est void*, non ?
struct complexe tampon ;
read(fichier, (char *) &tampon, sizeof tampon) ;
A quoi sert le cast ? Le type attendu par read() est void*, non ?
struct complexe tampon ;
read(fichier, (char *) &tampon, sizeof tampon) ;
A quoi sert le cast ? Le type attendu par read() est void*, non ?