AL

268400 -  
 Céplusplus -
Bonjour,
g un pb avec fseek voila mon program

void modification()
{
clrscr();
gotoxy(20,12);printf("donner le num a modifier...");
gotoxy(60,12);scanf("%d",&nc);
tr=0;
f=fopen("eleves","r+");
do
{
fread(&enr,sizeof(enr),1,f);
if (!feof(f))
{
if (nc==enr.num)
{
tr=1;
break;
}
}
}
while ((!feof(f)) && (tr==0));
if (tr==0)
{
gotoxy(30,14);printf("eleve non existant pas de modification");
getch();
}
else
{
ecran();
gotoxy(50,5);printf("%d",enr.num);
gotoxy(50,7);printf("%s",enr.nom);
gotoxy(50,9);printf("%d",enr.cl);
gotoxy(50,11);printf("%s",enr.fil);
gotoxy(50,13);printf("%5.2f",enr.n1);
gotoxy(50,15);printf("%5.2f",enr.n2);
gotoxy(50,17);printf("%5.2f",enr.moy);
gotoxy(22,22);printf("donnez le num de champ a modif...0 pour terminer...");
do
{

do
{
gotoxy(70,22);printf(" ");
gotoxy(70,22);scanf("%d",&chm);
}
while (chm<0 || chm>5);

switch (chm)
{
case 1:{
gotoxy(50,7);printf(" ");
gotoxy(50,7);scanf("%s",&enr.nom);
break;
}

case 2:{
gotoxy(50,9);printf(" ");
gotoxy(50,9);scanf("%d",&enr.cl);
break;
}

case 3: {
gotoxy(50,11);printf(" ");
gotoxy(50,11);scanf("%s",&enr.fil);
break;
}

case 4:{
do
{
gotoxy(50,13);printf(" ");
gotoxy(50,13);scanf("%f",&enr.n1);
}
while ( enr.n1>20 || enr.n1<0);
enr.moy=(enr.n1+enr.n2)/2;
gotoxy(50,17);printf("%10.2f",enr.moy);
break;
}
case 5: {
do
{
gotoxy(50,15);printf(" ");
gotoxy(50,15);scanf("%f",&enr.n2);
}
while ( enr.n2>20 || enr.n2<0);
enr.moy=(enr.n1+enr.n2)/2;
gotoxy(50,17);printf("%10.2f",enr.moy);
break;
}

}
}
while (chm!=0);

fseek(?);

fwrite(&enr,sizeof(enr),1,f);

}
fclose(f);
}

svp qlqun me aides moi
A voir également:

1 réponse

Céplusplus
 
T'as pas la moindre référence pour programmer ? pas le moindre petit manuel ? ou un accès à internet pour chercher fseek avec ton moteur de recherche préféré ?
si la réponse à toutes ces questions est non : comment tu as entendu parler de cette fonction ?
0